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_mutex_clocklock
Date: Thu, 29 Jul 2021 15:45:55 +0000 (GMT)	[thread overview]
Message-ID: <20210729154555.00D4739DC4E7@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5c4eaf45f168762008237c5ee73ad72cdd4cf47f

commit 5c4eaf45f168762008237c5ee73ad72cdd4cf47f
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Thu Jul 29 17:22:11 2021 +0200

    Cygwin: implement pthread_mutex_clocklock
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/common.din        |  1 +
 winsup/cygwin/include/pthread.h |  4 ++++
 winsup/cygwin/thread.cc         | 11 +++++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din
index a664f1d09..f7c27fd4d 100644
--- a/winsup/cygwin/common.din
+++ b/winsup/cygwin/common.din
@@ -1121,6 +1121,7 @@ pthread_join SIGFE
 pthread_key_create SIGFE
 pthread_key_delete SIGFE
 pthread_kill SIGFE
+pthread_mutex_clocklock SIGFE
 pthread_mutex_destroy SIGFE
 pthread_mutex_getprioceiling SIGFE
 pthread_mutex_init SIGFE
diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h
index e82a111ce..a55be5d40 100644
--- a/winsup/cygwin/include/pthread.h
+++ b/winsup/cygwin/include/pthread.h
@@ -167,6 +167,10 @@ int pthread_mutex_getprioceiling (const pthread_mutex_t *, int *);
 int pthread_mutex_init (pthread_mutex_t *, const pthread_mutexattr_t *);
 int pthread_mutex_lock (pthread_mutex_t *);
 int pthread_mutex_setprioceiling (pthread_mutex_t *, int, int *);
+#if __GNU_VISIBLE
+int pthread_mutex_clocklock (pthread_mutex_t *, clockid_t,
+			     const struct timespec *);
+#endif
 int pthread_mutex_timedlock (pthread_mutex_t *, const struct timespec *);
 int pthread_mutex_trylock (pthread_mutex_t *);
 int pthread_mutex_unlock (pthread_mutex_t *);
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 97fcf0c05..55184f8b9 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -3475,7 +3475,8 @@ pthread_mutex_lock (pthread_mutex_t *mutex)
 }
 
 extern "C" int
-pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *abstime)
+pthread_mutex_clocklock (pthread_mutex_t *mutex, clockid_t clock_id,
+			 const struct timespec *abstime)
 {
   LARGE_INTEGER timeout;
 
@@ -3491,7 +3492,7 @@ pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *abstime)
 
   __try
     {
-      int err = pthread_convert_abstime (CLOCK_REALTIME, abstime, &timeout);
+      int err = pthread_convert_abstime (clock_id, abstime, &timeout);
       if (err)
 	return err;
 
@@ -3502,6 +3503,12 @@ pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *abstime)
   return EINVAL;
 }
 
+extern "C" int
+pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *abstime)
+{
+  return pthread_mutex_clocklock (mutex, CLOCK_REALTIME, abstime);
+}
+
 extern "C" int
 pthread_mutex_trylock (pthread_mutex_t *mutex)
 {


                 reply	other threads:[~2021-07-29 15:45 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=20210729154555.00D4739DC4E7@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).