diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2018-04-22 18:59:13 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2018-04-22 19:01:57 +0100 |
commit | 04a676f3c8d2443499f27612f69ee88e12089e61 (patch) | |
tree | a6dac60812a5c5c748aa67330b81a36d667f3b9d /libpthread/linuxthreads/sysdeps/pthread | |
parent | d86bd35298834f3162459dde763f7976f5c2a523 (diff) |
linuxthreads: implement pthread_condattr_{s,g}etclock()
More applications are using pthread_condattr_setclock()/
pthread_condattr_getclock() in their code. Port these two
functions from NPTL over to be more compatible.
Diffstat (limited to 'libpthread/linuxthreads/sysdeps/pthread')
-rw-r--r-- | libpthread/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h | 9 | ||||
-rw-r--r-- | libpthread/linuxthreads/sysdeps/pthread/pthread.h | 12 |
2 files changed, 18 insertions, 3 deletions
diff --git a/libpthread/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h b/libpthread/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h index 3eb592919..638dc75c9 100644 --- a/libpthread/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h +++ b/libpthread/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h @@ -25,6 +25,8 @@ #define __need_schedparam #include <bits/sched.h> +#define __SIZEOF_PTHREAD_CONDATTR_T 4 + /* Fast locks (not abstract because mutexes and conditions aren't abstract). */ struct _pthread_fastlock { @@ -63,12 +65,13 @@ typedef struct } pthread_cond_t; -/* Attribute for conditionally variables. */ -typedef struct +typedef union { - int __dummy; + char __size[__SIZEOF_PTHREAD_CONDATTR_T]; + int __align; } pthread_condattr_t; + /* Keys for thread-specific data */ typedef unsigned int pthread_key_t; diff --git a/libpthread/linuxthreads/sysdeps/pthread/pthread.h b/libpthread/linuxthreads/sysdeps/pthread/pthread.h index 0d175025b..9bcd887ed 100644 --- a/libpthread/linuxthreads/sysdeps/pthread/pthread.h +++ b/libpthread/linuxthreads/sysdeps/pthread/pthread.h @@ -455,6 +455,18 @@ extern int pthread_condattr_getpshared (const pthread_condattr_t * extern int pthread_condattr_setpshared (pthread_condattr_t *__attr, int __pshared) __THROW; +#ifdef __USE_XOPEN2K +/* Get the clock selected for the condition variable attribute ATTR. */ +extern int pthread_condattr_getclock (const pthread_condattr_t * + __restrict __attr, + __clockid_t *__restrict __clock_id) + __THROW __nonnull ((1, 2)); + +/* Set the clock selected for the condition variable attribute ATTR. */ +extern int pthread_condattr_setclock (pthread_condattr_t *__attr, + __clockid_t __clock_id) + __THROW __nonnull ((1)); +#endif #if defined __USE_UNIX98 || defined __USE_XOPEN2K /* Functions for handling read-write locks. */ |