drd/tests: Add the "dlopen" test program
[valgrind.git] / drd / tests / dlopen_lib.c
blobea18fc5439544aef3b25b183de03b2f1786d4d13
1 #include <stdio.h>
2 #include <stdint.h>
3 #include <pthread.h>
4 #include "dlopen_lib.h"
6 void *PrintHello(void *threadid)
8 const long tid = (uintptr_t)threadid;
10 printf("Hello World! It's me, thread #%ld!\n", tid);
11 pthread_exit(NULL);
15 void foo()
17 pthread_t thread;
18 int rc;
19 uintptr_t t = 1;
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);