1
/* A simple example with 4 threads */
11
for(i=0;i<1000;i++) a[i] = (double)i;
14
static void *th(void *v)
23
*( (double*)v ) = sum;
25
/* make sure that no threads is so fast that it finishes
26
* before last thread is created, thus reusing the TID */
41
pthread_create(&t[i], NULL, th, &sum[i]);
44
pthread_join(t[i], NULL);