/* File tbug.c created by Steve Munroe on Thu Jan 15 2004. */ #include #include #include #include #include #include #define N 2 static void * tf (void *arg) { int n = (int) (long int) arg; char number[160]; sprintf(number, "tf(%ld): begin", (long)arg); puts (number); sleep (10); sprintf(number, "tf(%ld): end", (long)arg); puts (number); return NULL; } int main (int argc, char *argv[]) { int n; pthread_t th[N]; for (n = 0; n < N; ++n) if (pthread_create (&th[n], NULL, tf, (void *) (long int) n) != 0) { puts ("create failed"); exit (1); } puts("after create"); for (n = 0; n < N; ++n) if (pthread_join (th[n], NULL) != 0) { puts ("join failed"); exit (1); } puts("after join"); return 0; } /* Change Log <@log@> Thu Jan 15 2004 13:44:33 by Steve Munroe */