Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2021-07-29 18:13:47 +0300
committerCorinna Vinschen <corinna@vinschen.de>2021-07-29 18:13:47 +0300
commitedf48054e936055c86ef81ee99f6affb20e90d7c (patch)
tree0bd9199d480d7c5a6076d9c5004130122e710ce4 /winsup
parentd4e7869ee4505e2861e3ccdee7c187e56e6df142 (diff)
Cygwin: implement sem_clockwait
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/common.din1
-rw-r--r--winsup/cygwin/include/semaphore.h3
-rw-r--r--winsup/cygwin/pthread.cc8
-rw-r--r--winsup/cygwin/thread.cc5
-rw-r--r--winsup/cygwin/thread.h3
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
@@ -170,9 +170,15 @@ sem_trywait (sem_t * 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);