[newlib-cygwin] Cygwin: implement pthread_rwlock_clockrdlock/pthread_rwlock_clockwrlock
Corinna Vinschen
corinna@sourceware.org
Thu Jul 29 15:46:05 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c2ad78d67209b3b9cd7b64ea8a9c88cb0664fd71
commit c2ad78d67209b3b9cd7b64ea8a9c88cb0664fd71
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Thu Jul 29 17:31:31 2021 +0200
Cygwin: implement pthread_rwlock_clockrdlock/pthread_rwlock_clockwrlock
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/common.din | 2 ++
winsup/cygwin/include/pthread.h | 8 ++++++++
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;
@@ -3204,6 +3204,13 @@ pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock,
return EINVAL;
}
+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)
{
@@ -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;
@@ -3259,6 +3266,13 @@ pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock,
return EINVAL;
}
+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)
{
More information about the Cygwin-cvs
mailing list