blob: ec3e8edc5f00594a5a5c93b00db33e5e2d3f440b [file] [log] [blame]
bart96f892f2008-03-09 16:16:06 +00001/** Test whether DRD recognizes LinuxThreads as LinuxThreads and NPTL as
2 * NPTL.
3 */
4
5
6#include <pthread.h>
7#include <semaphore.h>
bart96f892f2008-03-09 16:16:06 +00008#include <unistd.h>
9
10
bart96f892f2008-03-09 16:16:06 +000011static pid_t s_main_thread_pid;
12
13
14void* thread_func(void* arg)
15{
16 if (s_main_thread_pid == getpid())
17 {
bartd029e462008-07-29 16:57:06 +000018 write(STDOUT_FILENO, "NPTL or non-Linux POSIX threads implementation detected.\n", 57);
bart96f892f2008-03-09 16:16:06 +000019 }
20 else
21 {
bartd029e462008-07-29 16:57:06 +000022 write(STDOUT_FILENO, "Detected LinuxThreads as POSIX threads implementation.\n", 55);
bart96f892f2008-03-09 16:16:06 +000023 }
bart96f892f2008-03-09 16:16:06 +000024 return 0;
25}
26
27int main(int argc, char** argv)
28{
29 pthread_t threadid;
30
31 s_main_thread_pid = getpid();
bart96f892f2008-03-09 16:16:06 +000032 pthread_create(&threadid, 0, thread_func, 0);
bart96f892f2008-03-09 16:16:06 +000033 pthread_join(threadid, 0);
bart96f892f2008-03-09 16:16:06 +000034 return 0;
35}