From fe7222913a6e42b65bfd92bc38479714316cfaf3 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 8 Dec 2007 22:11:14 +0000 Subject: [PATCH] *** empty log message *** --- ev.3 | 15 +++++++++++++-- ev.c | 2 +- ev.html | 16 +++++++++++++--- ev.pod | 13 ++++++++++++- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/ev.3 b/ev.3 index 5e213b8..d7dbe2e 100644 --- a/ev.3 +++ b/ev.3 @@ -636,9 +636,10 @@ usually a better approach for this kind of thing. .Sp Here are the gory details of what \f(CW\*(C`ev_loop\*(C'\fR does: .Sp -.Vb 18 +.Vb 19 +\& - Before the first iteration, call any pending watchers. \& * If there are no active watchers (reference count is zero), return. -\& - Queue prepare watchers and then call all outstanding watchers. +\& - Queue all prepare watchers and then call all outstanding watchers. \& - If we have been forked, recreate the kernel state. \& - Update the kernel state with all outstanding changes. \& - Update the "event loop time". @@ -1636,6 +1637,16 @@ with priority higher than or equal to the event loop and one coroutine of lower priority, but only once, using idle watchers to keep the event loop from blocking if lower-priority coroutines are active, thus mapping low-priority coroutines to idle/background tasks). +.PP +It is recommended to give \f(CW\*(C`ev_check\*(C'\fR watchers highest (\f(CW\*(C`EV_MAXPRI\*(C'\fR) +priority, to ensure that they are being run before any other watchers +after the poll. Also, \f(CW\*(C`ev_check\*(C'\fR watchers (and \f(CW\*(C`ev_prepare\*(C'\fR watchers, +too) should not activate (\*(L"feed\*(R") events into libev. While libev fully +supports this, they will be called before other \f(CW\*(C`ev_check\*(C'\fR watchers did +their job. As \f(CW\*(C`ev_check\*(C'\fR watchers are often used to embed other event +loops those other event loops might be in an unusable state until their +\&\f(CW\*(C`ev_check\*(C'\fR watcher ran (always remind yourself to coexist peacefully with +others). .IP "ev_prepare_init (ev_prepare *, callback)" 4 .IX Item "ev_prepare_init (ev_prepare *, callback)" .PD 0 diff --git a/ev.c b/ev.c index dbda0b9..628ccf9 100644 --- a/ev.c +++ b/ev.c @@ -1416,7 +1416,7 @@ ev_loop (EV_P_ int flags) } #endif - /* queue check watchers (and execute them) */ + /* queue prepare watchers (and execute them) */ if (expect_false (preparecnt)) { queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); diff --git a/ev.html b/ev.html index 1dcdd21..da28682 100644 --- a/ev.html +++ b/ev.html @@ -6,7 +6,7 @@ - + @@ -531,8 +531,9 @@ external event in conjunction with something not expressible using other libev watchers. However, a pair of ev_prepare/ev_check watchers is usually a better approach for this kind of thing.

Here are the gory details of what ev_loop does:

-
   * If there are no active watchers (reference count is zero), return.
-   - Queue prepare watchers and then call all outstanding watchers.
+
   - Before the first iteration, call any pending watchers.
+   * If there are no active watchers (reference count is zero), return.
+   - Queue all prepare watchers and then call all outstanding watchers.
    - If we have been forked, recreate the kernel state.
    - Update the kernel state with all outstanding changes.
    - Update the "event loop time".
@@ -1485,6 +1486,15 @@ with priority higher than or equal to the event loop and one coroutine
 of lower priority, but only once, using idle watchers to keep the event
 loop from blocking if lower-priority coroutines are active, thus mapping
 low-priority coroutines to idle/background tasks).

+

It is recommended to give ev_check watchers highest (EV_MAXPRI) +priority, to ensure that they are being run before any other watchers +after the poll. Also, ev_check watchers (and ev_prepare watchers, +too) should not activate ("feed") events into libev. While libev fully +supports this, they will be called before other ev_check watchers did +their job. As ev_check watchers are often used to embed other event +loops those other event loops might be in an unusable state until their +ev_check watcher ran (always remind yourself to coexist peacefully with +others).

ev_prepare_init (ev_prepare *, callback)
ev_check_init (ev_check *, callback)
diff --git a/ev.pod b/ev.pod index 538b9f8..237bdb0 100644 --- a/ev.pod +++ b/ev.pod @@ -488,8 +488,9 @@ usually a better approach for this kind of thing. Here are the gory details of what C does: + - Before the first iteration, call any pending watchers. * If there are no active watchers (reference count is zero), return. - - Queue prepare watchers and then call all outstanding watchers. + - Queue all prepare watchers and then call all outstanding watchers. - If we have been forked, recreate the kernel state. - Update the kernel state with all outstanding changes. - Update the "event loop time". @@ -1483,6 +1484,16 @@ of lower priority, but only once, using idle watchers to keep the event loop from blocking if lower-priority coroutines are active, thus mapping low-priority coroutines to idle/background tasks). +It is recommended to give C watchers highest (C) +priority, to ensure that they are being run before any other watchers +after the poll. Also, C watchers (and C watchers, +too) should not activate ("feed") events into libev. While libev fully +supports this, they will be called before other C watchers did +their job. As C watchers are often used to embed other event +loops those other event loops might be in an unusable state until their +C watcher ran (always remind yourself to coexist peacefully with +others). + =over 4 =item ev_prepare_init (ev_prepare *, callback) -- 2.43.0