drd: Add a consistency check
[valgrind.git] / drd / tests / linuxthreads_det.c
blobec3e8edc5f00594a5a5c93b00db33e5e2d3f440b
1 /** Test whether DRD recognizes LinuxThreads as LinuxThreads and NPTL as
2 * NPTL.
3 */
6 #include <pthread.h>
7 #include <semaphore.h>
8 #include <unistd.h>
11 static pid_t s_main_thread_pid;
14 void* thread_func(void* arg)
16 if (s_main_thread_pid == getpid())
18 write(STDOUT_FILENO, "NPTL or non-Linux POSIX threads implementation detected.\n", 57);
20 else
22 write(STDOUT_FILENO, "Detected LinuxThreads as POSIX threads implementation.\n", 55);
24 return 0;
27 int main(int argc, char** argv)
29 pthread_t threadid;
31 s_main_thread_pid = getpid();
32 pthread_create(&threadid, 0, thread_func, 0);
33 pthread_join(threadid, 0);
34 return 0;