hg06_readshared.stderr.exp \
hg06_readshared.stderr.exp-linuxthreads \
hg06_readshared.vgtest \
+ linuxthreads_det.stderr.exp \
+ linuxthreads_det.stderr.exp-linuxthreads \
+ linuxthreads_det.stdout.exp \
+ linuxthreads_det.stdout.exp-linuxthreads \
matinv.stderr.exp \
matinv.stderr.exp-linuxthreads \
matinv.stdout.exp \
matinv.stdout.exp-linuxthreads \
- matinv.stdout.exp-linuxthreads \
matinv.vgtest \
pth_barrier.stderr.exp \
pth_barrier.stderr.exp-linuxthreads \
hg04_race \
hg05_race2 \
hg06_readshared \
+ linuxthreads_det \
matinv \
pth_barrier \
pth_broadcast \
hg06_readshared_SOURCES = ../../helgrind/tests/hg06_readshared.c
hg06_readshared_LDADD = -lpthread
+linuxthreads_det_SOURCES = linuxthreads_det.c
+linuxthreads_det_LDADD = -lpthread
+
matinv_SOURCES = matinv.c
matinv_LDADD = -lpthread -lm
if HAVE_GCC_FOPENMP
matinv_openmp_SOURCES = matinv_openmp.c
matinv_openmp_CFLAGS = -fopenmp
-matinv_openmp_LDADD = -lpthread -lm
+matinv_openmp_LDADD = -lm
endif
pth_barrier_SOURCES = pth_barrier.c
--- /dev/null
+/** Test whether DRD recognizes LinuxThreads as LinuxThreads and NPTL as
+ * NPTL.
+ */
+
+
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <unistd.h>
+
+
+static sem_t s_sem;
+static pid_t s_main_thread_pid;
+
+
+void* thread_func(void* arg)
+{
+ if (s_main_thread_pid == getpid())
+ {
+ printf("NPTL or non-Linux POSIX threads implemenentation detected.\n");
+ }
+ else
+ {
+ printf("Detected LinuxThreads as POSIX threads implemenentation.\n");
+ }
+ sem_post(&s_sem);
+ return 0;
+}
+
+int main(int argc, char** argv)
+{
+ pthread_t threadid;
+
+ s_main_thread_pid = getpid();
+ sem_init(&s_sem, 0, 0);
+ pthread_create(&threadid, 0, thread_func, 0);
+ sem_wait(&s_sem);
+ pthread_join(threadid, 0);
+ sem_destroy(&s_sem);
+ return 0;
+}