diff options
Diffstat (limited to 'lib/librthread')
-rw-r--r-- | lib/librthread/synch.h | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/librthread/synch.h b/lib/librthread/synch.h index 2cec188e265..eee41d78e8b 100644 --- a/lib/librthread/synch.h +++ b/lib/librthread/synch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: synch.h,v 1.4 2018/06/08 13:53:01 pirofti Exp $ */ +/* $OpenBSD: synch.h,v 1.5 2019/10/21 10:06:31 mpi Exp $ */ /* * Copyright (c) 2017 Martin Pieuchot * @@ -22,14 +22,7 @@ static inline int _wake(volatile uint32_t *p, int n) { - return futex(p, FUTEX_WAKE, n, NULL, NULL); -} - -static inline void -_wait(volatile uint32_t *p, int val) -{ - while (*p != (uint32_t)val) - futex(p, FUTEX_WAIT, val, NULL, NULL); + return futex(p, FUTEX_WAKE_PRIVATE, n, NULL, NULL); } static inline int @@ -38,7 +31,7 @@ _twait(volatile uint32_t *p, int val, clockid_t clockid, const struct timespec * struct timespec rel; if (abs == NULL) - return futex(p, FUTEX_WAIT, val, NULL, NULL); + return futex(p, FUTEX_WAIT_PRIVATE, val, NULL, NULL); if (abs->tv_nsec >= 1000000000 || clock_gettime(clockid, &rel)) return (EINVAL); @@ -51,11 +44,11 @@ _twait(volatile uint32_t *p, int val, clockid_t clockid, const struct timespec * if (rel.tv_sec < 0) return (ETIMEDOUT); - return futex(p, FUTEX_WAIT, val, &rel, NULL); + return futex(p, FUTEX_WAIT_PRIVATE, val, &rel, NULL); } static inline int _requeue(volatile uint32_t *p, int n, int m, volatile uint32_t *q) { - return futex(p, FUTEX_REQUEUE, n, (void *)(long)m, q); + return futex(p, FUTEX_REQUEUE_PRIVATE, n, (void *)(long)m, q); } |