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 sem_clockwait Date: Thu, 29 Jul 2021 15:45:44 +0000 (GMT) [thread overview] Message-ID: <20210729154544.E5EE339DC4D9@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=edf48054e936055c86ef81ee99f6affb20e90d7c commit edf48054e936055c86ef81ee99f6affb20e90d7c Author: Corinna Vinschen <corinna@vinschen.de> Date: Thu Jul 29 17:13:47 2021 +0200 Cygwin: implement sem_clockwait Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- winsup/cygwin/common.din | 1 + winsup/cygwin/include/semaphore.h | 3 +++ winsup/cygwin/pthread.cc | 8 +++++++- winsup/cygwin/thread.cc | 5 +++-- winsup/cygwin/thread.h | 3 ++- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din index 6e5dde80d..ce6ed78c8 100644 --- a/winsup/cygwin/common.din +++ b/winsup/cygwin/common.din @@ -1287,6 +1287,7 @@ secure_getenv NOSIGFE seed48 NOSIGFE seekdir SIGFE select = cygwin_select SIGFE +sem_clockwait SIGFE sem_close SIGFE sem_destroy SIGFE sem_getvalue SIGFE diff --git a/winsup/cygwin/include/semaphore.h b/winsup/cygwin/include/semaphore.h index 036eaceea..e20bdc581 100644 --- a/winsup/cygwin/include/semaphore.h +++ b/winsup/cygwin/include/semaphore.h @@ -32,6 +32,9 @@ extern "C" int sem_unlink (const char *__name); int sem_wait (sem_t *__sem); int sem_trywait (sem_t *__sem); +#if __GNU_VISIBLE + int sem_clockwait (sem_t *__sem, clockid_t __clock_id, const struct timespec *__abstime); +#endif int sem_timedwait (sem_t *__sem, const struct timespec *__abstime); int sem_post (sem_t *__sem); int sem_getvalue (sem_t *__sem, int *__sval); diff --git a/winsup/cygwin/pthread.cc b/winsup/cygwin/pthread.cc index e7f87f9fe..5d0c0eeaa 100644 --- a/winsup/cygwin/pthread.cc +++ b/winsup/cygwin/pthread.cc @@ -169,10 +169,16 @@ sem_trywait (sem_t * sem) return semaphore::trywait (sem); } +int +sem_clockwait (sem_t * sem, clockid_t clock_id, const struct timespec *abstime) +{ + return semaphore::clockwait (sem, clock_id, abstime); +} + int sem_timedwait (sem_t * sem, const struct timespec *abstime) { - return semaphore::timedwait (sem, abstime); + return semaphore::clockwait (sem, CLOCK_REALTIME, abstime); } int diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 617be57c2..36b78b309 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -4002,7 +4002,8 @@ semaphore::trywait (sem_t *sem) } int -semaphore::timedwait (sem_t *sem, const struct timespec *abstime) +semaphore::clockwait (sem_t *sem, clockid_t clock_id, + const struct timespec *abstime) { LARGE_INTEGER timeout; @@ -4019,7 +4020,7 @@ semaphore::timedwait (sem_t *sem, 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; diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index c574a3915..6b699ccb6 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -679,7 +679,8 @@ public: static int post (sem_t *sem); static int getvalue (sem_t *sem, int *sval); static int trywait (sem_t *sem); - static int timedwait (sem_t *sem, const struct timespec *abstime); + static int clockwait (sem_t *sem, clockid_t clock_id, + const struct timespec *abstime); static int getinternal (sem_t *sem, int *sfd, unsigned long long *shash, LUID *sluid, unsigned int *sval);
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=20210729154544.E5EE339DC4D9@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: linkBe 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).