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: move POSIX semaphore API functions to posix_ipc.cc
Date: Wed, 10 Aug 2022 16:14:11 +0000 (GMT)	[thread overview]
Message-ID: <20220810161411.9C829385AC26@sourceware.org> (raw)

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);
-}
-
 }


                 reply	other threads:[~2022-08-10 16:14 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=20220810161411.9C829385AC26@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).