#include #include #include static int counter; static void *body(void *p) { int i; const char *s = p; for (i = 0; i < 5; i++) { printf("%s: %d\n", s, counter++); } return NULL; } int main(int argc, char *argv[]) { pthread_t id; void *dummy; int res; counter = 10; res = pthread_create(&id, NULL, body, (void *)"Child"); if (res) { perror("pthread_create"); return -1; } body("Father"); pthread_join(id, &dummy); return 0; }