summaryrefslogtreecommitdiff
path: root/ev.c
diff options
context:
space:
mode:
authorroot <root>2007-11-27 10:59:10 +0000
committerroot <root>2007-11-27 10:59:10 +0000
commit2e4f855ad17fd958d1643d2170054734053033fc (patch)
tree45b3c8fa4bf0b781f443aea504b3edc02e6f2fd2 /ev.c
parentba71cf07f3506b8e303130e981d3b5b3e9ea5dc8 (diff)
docs
Diffstat (limited to 'ev.c')
-rw-r--r--ev.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/ev.c b/ev.c
index 40e2292..bf20d1a 100644
--- a/ev.c
+++ b/ev.c
@@ -1278,6 +1278,14 @@ ev_loop (EV_P_ int flags)
while (activecnt)
{
+ /* we might have forked, so reify kernel state if necessary */
+ if (expect_false (postfork))
+ if (forkcnt)
+ {
+ queue_events (EV_A_ (W *)forks, forkcnt, EV_FORK);
+ call_pending (EV_A);
+ }
+
/* queue check watchers (and execute them) */
if (expect_false (preparecnt))
{
@@ -1829,6 +1837,35 @@ ev_embed_stop (EV_P_ ev_embed *w)
}
#endif
+#if EV_FORK_ENABLE
+void
+ev_fork_start (EV_P_ ev_fork *w)
+{
+ if (expect_false (ev_is_active (w)))
+ return;
+
+ ev_start (EV_A_ (W)w, ++forkcnt);
+ array_needsize (ev_fork *, forks, forkmax, forkcnt, EMPTY2);
+ forks [forkcnt - 1] = w;
+}
+
+void
+ev_fork_stop (EV_P_ ev_fork *w)
+{
+ ev_clear_pending (EV_A_ (W)w);
+ if (expect_false (!ev_is_active (w)))
+ return;
+
+ {
+ int active = ((W)w)->active;
+ forks [active - 1] = forks [--forkcnt];
+ ((W)forks [active - 1])->active = active;
+ }
+
+ ev_stop (EV_A_ (W)w);
+}
+#endif
+
/*****************************************************************************/
struct ev_once