1 #include "test.h" 2 3 void * func(void * arg)4func(void * arg) 5 { 6 pthread_exit(arg); 7 8 /* Never reached. */ 9 assert(0); 10 11 return NULL; 12 } 13 14 int main(int argc,char * argv[])15main(int argc, char * argv[]) 16 { 17 pthread_t id[4]; 18 int i; 19 20 /* Create a few threads and then exit. */ 21 for (i = 0; i < 4; i++) 22 { 23 assert(pthread_create(&id[i], NULL, func, ((void *) (size_t) i)) == 0); 24 } 25 26 Sleep(1000); 27 28 /* Success. */ 29 return 0; 30 } 31