#include #include // This function is called to start thread execution. // It can be given any pointer as an argument. void *run_thread (void *argument) { int *p = argument; printf ("Hello my input was %d\n", *p); // A thread finishes when either the thread's start function // returns, or the thread calls `pthread_exit(3)'. // A thread can return a pointer of any type --- that pointer // can be fetched via `pthread_join(3)' return NULL; } int main (void) { pthread_t thread_id1; int input = 42 ; pthread_create (&thread_id1, NULL, run_thread, &input); pthread_join(thread_id1, NULL); return 0; }