public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: move POSIX semaphore API functions to posix_ipc.cc
@ 2022-08-10 16:14 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2022-08-10 16:14 UTC (permalink / raw)
  To: cygwin-cvs

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

commit bf1d972d5c397125d879d6334c84012f166af9eb
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Aug 10 18:11:57 2022 +0200

    Cygwin: move POSIX semaphore API functions to posix_ipc.cc
    
    This way, the sem API is all in the same place, even if the
    underlying semaphore class is still in thread.cc.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/posix_ipc.cc | 48 ++++++++++++++++++++++++++++++++++++++++++++
 winsup/cygwin/thread.cc    | 50 ----------------------------------------------
 2 files changed, 48 insertions(+), 50 deletions(-)

diff --git a/winsup/cygwin/posix_ipc.cc b/winsup/cygwin/posix_ipc.cc
index 68d66e410..34fd2ba34 100644
--- a/winsup/cygwin/posix_ipc.cc
+++ b/winsup/cygwin/posix_ipc.cc
@@ -518,3 +518,51 @@ sem_unlink (const char *name)
     return -1;
   return 0;
 }
+
+extern "C" int
+sem_init (sem_t * sem, int pshared, unsigned int value)
+{
+  return semaphore::init (sem, pshared, value);
+}
+
+extern "C" int
+sem_destroy (sem_t * sem)
+{
+  return semaphore::destroy (sem);
+}
+
+extern "C" int
+sem_wait (sem_t * sem)
+{
+  return semaphore::wait (sem);
+}
+
+extern "C" int
+sem_trywait (sem_t * sem)
+{
+  return semaphore::trywait (sem);
+}
+
+extern "C" int
+sem_clockwait (sem_t * sem, clockid_t clock_id, const struct timespec *abstime)
+{
+  return semaphore::clockwait (sem, clock_id, abstime);
+}
+
+extern "C" int
+sem_timedwait (sem_t * sem, const struct timespec *abstime)
+{
+  return semaphore::clockwait (sem, CLOCK_REALTIME, abstime);
+}
+
+extern "C" int
+sem_post (sem_t *sem)
+{
+  return semaphore::post (sem);
+}
+
+extern "C" int
+sem_getvalue (sem_t * sem, int *sval)
+{
+  return semaphore::getvalue (sem, sval);
+}
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index d818e8060..5c1284a93 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -4559,54 +4559,4 @@ pthread_getcpuclockid (pthread_t thread, clockid_t *clk_id)
   return 0;
 }
 
-/* Semaphores */
-
-int
-sem_init (sem_t * sem, int pshared, unsigned int value)
-{
-  return semaphore::init (sem, pshared, value);
-}
-
-int
-sem_destroy (sem_t * sem)
-{
-  return semaphore::destroy (sem);
-}
-
-int
-sem_wait (sem_t * sem)
-{
-  return semaphore::wait (sem);
-}
-
-int
-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::clockwait (sem, CLOCK_REALTIME, abstime);
-}
-
-int
-sem_post (sem_t *sem)
-{
-  return semaphore::post (sem);
-}
-
-int
-sem_getvalue (sem_t * sem, int *sval)
-{
-  return semaphore::getvalue (sem, sval);
-}
-
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-10 16:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-10 16:14 [newlib-cygwin] Cygwin: move POSIX semaphore API functions to posix_ipc.cc Corinna Vinschen

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