summaryrefslogtreecommitdiff
path: root/ev.c
diff options
context:
space:
mode:
Diffstat (limited to 'ev.c')
-rw-r--r--ev.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/ev.c b/ev.c
index 512e15d..c7e5077 100644
--- a/ev.c
+++ b/ev.c
@@ -1,7 +1,7 @@
/*
* libev event processing core, watcher management
*
- * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
@@ -1371,19 +1371,28 @@ pipecb (EV_P_ ev_io *iow, int revents)
/*****************************************************************************/
-static void
-ev_sighandler (int signum)
+void
+ev_feed_signal (int signum)
{
#if EV_MULTIPLICITY
EV_P = signals [signum - 1].loop;
+
+ if (!EV_A)
+ return;
#endif
+ signals [signum - 1].pending = 1;
+ evpipe_write (EV_A_ &sig_pending);
+}
+
+static void
+ev_sighandler (int signum)
+{
#ifdef _WIN32
signal (signum, ev_sighandler);
#endif
- signals [signum - 1].pending = 1;
- evpipe_write (EV_A_ &sig_pending);
+ ev_feed_signal (signum);
}
void noinline
@@ -1645,6 +1654,8 @@ loop_init (EV_P_ unsigned int flags)
{
if (!backend)
{
+ origflags = flags;
+
#if EV_USE_REALTIME
if (!have_realtime)
{
@@ -1699,7 +1710,7 @@ loop_init (EV_P_ unsigned int flags)
sigfd = flags & EVFLAG_SIGNALFD ? -2 : -1;
#endif
- if (!(flags & 0x0000ffffU))
+ if (!(flags & EVBACKEND_MASK))
flags |= ev_recommended_backends ();
#if EV_USE_IOCP
@@ -2881,9 +2892,12 @@ ev_signal_start (EV_P_ ev_signal *w)
sa.sa_flags = SA_RESTART; /* if restarting works we save one iteration */
sigaction (w->signum, &sa, 0);
- sigemptyset (&sa.sa_mask);
- sigaddset (&sa.sa_mask, w->signum);
- sigprocmask (SIG_UNBLOCK, &sa.sa_mask, 0);
+ if (origflags & EVFLAG_NOSIGMASK)
+ {
+ sigemptyset (&sa.sa_mask);
+ sigaddset (&sa.sa_mask, w->signum);
+ sigprocmask (SIG_UNBLOCK, &sa.sa_mask, 0);
+ }
#endif
}