diff options
Diffstat (limited to 'lib/libthr/thread/thr_condattr.c')
-rw-r--r-- | lib/libthr/thread/thr_condattr.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libthr/thread/thr_condattr.c b/lib/libthr/thread/thr_condattr.c index 52b9f51..7ce827b 100644 --- a/lib/libthr/thread/thr_condattr.c +++ b/lib/libthr/thread/thr_condattr.c @@ -105,20 +105,21 @@ _pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id) int _pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared) { + if (attr == NULL || *attr == NULL) return (EINVAL); - - *pshared = PTHREAD_PROCESS_PRIVATE; + *pshared = (*attr)->c_pshared; return (0); } int _pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared) { - if (attr == NULL || *attr == NULL) - return (EINVAL); - if (pshared != PTHREAD_PROCESS_PRIVATE) + if (attr == NULL || *attr == NULL || + (pshared != PTHREAD_PROCESS_PRIVATE && + pshared != PTHREAD_PROCESS_SHARED)) return (EINVAL); + (*attr)->c_pshared = pshared; return (0); } |