#include #include /* do not need stdlib.h */ /* do not need wait.h */ /* declare a global variable */ static int check = 0; /* function to be executed by created thread */ void* go_smith(void* arg) { pthread_t *psmith = (pthread_t*) arg; check++; printf("I am Agent Smith %u @%p (%d)\n",(unsigned)*psmith,&check,check); pthread_exit(0); } int main(int argc, char *argv[]) { pthread_t smith; check++; pthread_create(&smith,0x0,&go_smith,&smith); pthread_join(smith,0x0); /* wait for create thread to finish */ printf("I am Agent Smith 0 @%p (%d)\n",&check,check); return 0; }