1 /** Test whether DRD recognizes LinuxThreads as LinuxThreads and NPTL as
2  *  NPTL.
3  */
4 
5 
6 #include <pthread.h>
7 #include <semaphore.h>
8 #include <unistd.h>
9 
10 
11 static pid_t s_main_thread_pid;
12 
13 
14 void* thread_func(void* arg)
15 {
16   if (s_main_thread_pid == getpid())
17   {
18     write(STDOUT_FILENO, "NPTL or non-Linux POSIX threads implementation detected.\n", 57);
19   }
20   else
21   {
22     write(STDOUT_FILENO, "Detected LinuxThreads as POSIX threads implementation.\n", 55);
23   }
24   return 0;
25 }
26 
27 int main(int argc, char** argv)
28 {
29   pthread_t threadid;
30 
31   s_main_thread_pid = getpid();
32   pthread_create(&threadid, 0, thread_func, 0);
33   pthread_join(threadid, 0);
34   return 0;
35 }
36