From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 0F7FA39DC4D2; Thu, 29 Jul 2021 15:46:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0F7FA39DC4D2 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: implement pthread_rwlock_clockrdlock/pthread_rwlock_clockwrlock X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 520c3a3fa237701580975a55e4f4c3bb94bb6915 X-Git-Newrev: c2ad78d67209b3b9cd7b64ea8a9c88cb0664fd71 Message-Id: <20210729154605.0F7FA39DC4D2@sourceware.org> Date: Thu, 29 Jul 2021 15:46:05 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 15:46:05 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c2ad78d67209b3b9cd7b64ea8a9c88cb0664fd71 commit c2ad78d67209b3b9cd7b64ea8a9c88cb0664fd71 Author: Corinna Vinschen Date: Thu Jul 29 17:31:31 2021 +0200 Cygwin: implement pthread_rwlock_clockrdlock/pthread_rwlock_clockwrlock Signed-off-by: Corinna Vinschen 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) {