public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: implement pthread_rwlock_clockrdlock/pthread_rwlock_clockwrlock
Date: Thu, 29 Jul 2021 15:46:05 +0000 (GMT)	[thread overview]
Message-ID: <20210729154605.0F7FA39DC4D2@sourceware.org> (raw)

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)
 {


                 reply	other threads:[~2021-07-29 15:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210729154605.0F7FA39DC4D2@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).