1 #include <stdio.h> 2 #include <stdint.h> 3 #include <pthread.h> 4 #include "dlopen_lib.h" 5 6 void *PrintHello(void *threadid) 7 { 8 const long tid = (uintptr_t)threadid; 9 10 printf("Hello World! It's me, thread #%ld!\n", tid); 11 pthread_exit(NULL); 12 } 13 14 15 void foo() 16 { 17 pthread_t thread; 18 int rc; 19 uintptr_t t = 1; 20 21 printf("In main: creating thread %ld\n", t); 22 rc = pthread_create(&thread, NULL, PrintHello, (void *)t); 23 if (rc) 24 printf("ERROR; return code from pthread_create() is %d\n", rc); 25 else 26 pthread_join(thread, NULL); 27 } 28