1 #include <stdio.h> 2 #include <pthread.h> 3 #include <unistd.h> 4 5 int threads_up_and_running = 0; 6 7 void * second_thread(void * in)8second_thread (void *in) 9 { 10 pthread_setname_np ("second thread"); 11 while (1) 12 sleep (1); 13 return NULL; 14 } 15 16 void * third_thread(void * in)17third_thread (void *in) 18 { 19 pthread_setname_np ("third thread"); 20 while (1) 21 sleep (1); 22 return NULL; 23 } 24 main()25int main () 26 { 27 pthread_setname_np ("main thread"); 28 pthread_t other_thread; 29 pthread_create (&other_thread, NULL, second_thread, NULL); 30 pthread_create (&other_thread, NULL, third_thread, NULL); 31 32 threads_up_and_running = 1; 33 34 while (1) 35 sleep (1); 36 } 37