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
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/signal.cc')
-rw-r--r--winsup/cygwin/signal.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index 72664b10d..4dde8127c 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -478,9 +478,18 @@ siginterrupt (int sig, int flag)
return sigaction (sig, &act, NULL);
}
+extern "C" int
+sigwait (const sigset_t *set, int *sig_ptr)
+{
+ siginfo_t si;
+ int pid = sigwaitinfo (set, NULL);
+ if (pid > 0)
+ *sig_ptr = pid;
+ return pid > 0 ? 0 : -1;
+}
extern "C" int
-sigwait (const sigset_t *set, int *sig)
+sigwaitinfo (const sigset_t *set, siginfo_t *info)
{
pthread_testcancel ();
HANDLE h;
@@ -497,15 +506,16 @@ sigwait (const sigset_t *set, int *sig)
switch (WaitForSingleObject (_my_tls.event, INFINITE))
{
case WAIT_OBJECT_0:
- *sig = InterlockedExchange ((LONG *) &_my_tls.sig, (LONG) 0);
- res = 0;
+ res = _my_tls.infodata.si_pid;
+ if (info)
+ *info = _my_tls.infodata;
break;
default:
__seterrno ();
res = -1;
}
_my_tls.event = NULL;
- _my_tls.sig = 0;
+ InterlockedExchange ((LONG *) &_my_tls.sig, (LONG) 0);
CloseHandle (h);
sig_dispatch_pending ();
return res;