aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads/tst-clock1.c
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/tst-clock1.c')
-rw-r--r--linuxthreads/tst-clock1.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/linuxthreads/tst-clock1.c b/linuxthreads/tst-clock1.c
index 54f5041282..bca40956e2 100644
--- a/linuxthreads/tst-clock1.c
+++ b/linuxthreads/tst-clock1.c
@@ -25,7 +25,7 @@
#include <unistd.h>
-#if _POSIX_THREAD_CPUTIME
+#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0
static pthread_barrier_t b2;
static pthread_barrier_t bN;
@@ -55,9 +55,17 @@ tf (void *arg)
int
do_test (void)
{
-#if _POSIX_THREAD_CPUTIME
+#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0
# define N 10
+# if _POSIX_THREAD_CPUTIME == 0
+ if (sysconf (_SC_THREAD_CPUTIME) < 0)
+ {
+ puts ("_POSIX_THREAD_CPUTIME option not available");
+ return 0;
+ }
+# endif
+
if (pthread_barrier_init (&b2, NULL, 2) != 0
|| pthread_barrier_init (&bN, NULL, N + 1) != 0)
{