#include #include struct param{ char character; /* i caratteri da stampare */ int count; /* numero di volte */ }; void* stampa (void* parametri) { int i; struct param* p = (struct param*) parametri; for (i = 0; i < p->count; ++i) printf ("%c",p->character); return NULL; } int main (){ pthread_t thread1_id, thread2_id; int n1,n2; struct param thread1_args, thread2_args; thread1_args.character = 'x'; thread1_args.count = 300; n1=pthread_create (&thread1_id,NULL, stampa, (void*)&thread1_args);/*stampa 300 x*/ thread2_args.character = 'o'; thread2_args.count = 200; n2=pthread_create (&thread2_id, NULL, stampa, (void*)&thread2_args);/*stampa 200 o*/ printf("dal 1o thread %d; dal 2o thread %d\n",n1,n2); }