diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2021-07-29 18:31:31 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2021-07-29 18:31:31 +0300 |
commit | c2ad78d67209b3b9cd7b64ea8a9c88cb0664fd71 (patch) | |
tree | 380b5fb4c8056ef902a9ce1aab8159d05744c473 | |
parent | 520c3a3fa237701580975a55e4f4c3bb94bb6915 (diff) |
Cygwin: implement pthread_rwlock_clockrdlock/pthread_rwlock_clockwrlock
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | winsup/cygwin/common.din | 2 | ||||
-rw-r--r-- | winsup/cygwin/include/pthread.h | 8 | ||||
-rw-r--r-- | winsup/cygwin/thread.cc | 22 |
3 files changed, 28 insertions, 4 deletions
diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din index f7c27fd4d..b09d3551f 100644 --- a/winsup/cygwin/common.din +++ b/winsup/cygwin/common.din @@ -1141,6 +1141,8 @@ pthread_mutexattr_setprotocol SIGFE pthread_mutexattr_setpshared SIGFE pthread_mutexattr_settype SIGFE pthread_once SIGFE +pthread_rwlock_clockrdlock SIGFE +pthread_rwlock_clockwrlock SIGFE pthread_rwlock_destroy SIGFE pthread_rwlock_init SIGFE pthread_rwlock_rdlock SIGFE diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h index 6b7b6dde5..66d367d62 100644 --- a/winsup/cygwin/include/pthread.h +++ b/winsup/cygwin/include/pthread.h @@ -199,9 +199,17 @@ int pthread_spin_unlock (pthread_spinlock_t *); int pthread_rwlock_destroy (pthread_rwlock_t *); int pthread_rwlock_init (pthread_rwlock_t *, const pthread_rwlockattr_t *); int pthread_rwlock_rdlock (pthread_rwlock_t *); +#if __GNU_VISIBLE +int pthread_rwlock_clockrdlock (pthread_rwlock_t *, clockid_t, + const struct timespec *); +#endif int pthread_rwlock_timedrdlock (pthread_rwlock_t *, const struct timespec *); int pthread_rwlock_tryrdlock (pthread_rwlock_t *); int pthread_rwlock_wrlock (pthread_rwlock_t *); +#if __GNU_VISIBLE +int pthread_rwlock_clockwrlock (pthread_rwlock_t *, clockid_t, + const struct timespec *); +#endif int pthread_rwlock_timedwrlock (pthread_rwlock_t *, const struct timespec *); int pthread_rwlock_trywrlock (pthread_rwlock_t *); int pthread_rwlock_unlock (pthread_rwlock_t *); diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 55184f8b9..4d0ea274f 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -3174,7 +3174,7 @@ pthread_rwlock_rdlock (pthread_rwlock_t *rwlock) } extern "C" int -pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock, +pthread_rwlock_clockrdlock (pthread_rwlock_t *rwlock, clockid_t clock_id, const struct timespec *abstime) { LARGE_INTEGER timeout; @@ -3193,7 +3193,7 @@ pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock, __try { - int err = pthread_convert_abstime (CLOCK_REALTIME, abstime, &timeout); + int err = pthread_convert_abstime (clock_id, abstime, &timeout); if (err) return err; @@ -3205,6 +3205,13 @@ pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock, } extern "C" int +pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock, + const struct timespec *abstime) +{ + return pthread_rwlock_clockrdlock (rwlock, CLOCK_REALTIME, abstime); +} + +extern "C" int pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock) { if (pthread_rwlock::is_initializer (rwlock)) @@ -3229,7 +3236,7 @@ pthread_rwlock_wrlock (pthread_rwlock_t *rwlock) } extern "C" int -pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, +pthread_rwlock_clockwrlock (pthread_rwlock_t *rwlock, clockid_t clock_id, const struct timespec *abstime) { LARGE_INTEGER timeout; @@ -3248,7 +3255,7 @@ pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, __try { - int err = pthread_convert_abstime (CLOCK_REALTIME, abstime, &timeout); + int err = pthread_convert_abstime (clock_id, abstime, &timeout); if (err) return err; @@ -3260,6 +3267,13 @@ pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, } extern "C" int +pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, + const struct timespec *abstime) +{ + return pthread_rwlock_clockwrlock (rwlock, CLOCK_REALTIME, abstime); +} + +extern "C" int pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock) { if (pthread_rwlock::is_initializer (rwlock)) |