summaryrefslogtreecommitdiff
path: root/ev.pod
diff options
context:
space:
mode:
Diffstat (limited to 'ev.pod')
-rw-r--r--ev.pod8
1 files changed, 8 insertions, 0 deletions
diff --git a/ev.pod b/ev.pod
index 47204ab..81dd6a9 100644
--- a/ev.pod
+++ b/ev.pod
@@ -277,6 +277,10 @@ flags. If that is troubling you, check C<ev_backend ()> afterwards).
If you don't know what event loop to use, use the one returned from this
function.
+Note that this function is I<not> thread-safe, so if you want to use it
+from multiple threads, you have to lock (note also that this is unlikely,
+as loops cannot bes hared easily between threads anyway).
+
The default loop is the only loop that can handle C<ev_signal> and
C<ev_child> watchers, and to do this, it always registers a handler
for C<SIGCHLD>. If this is a problem for your app you can either
@@ -468,6 +472,10 @@ always distinct from the default loop. Unlike the default loop, it cannot
handle signal and child watchers, and attempts to do so will be greeted by
undefined behaviour (or a failed assertion if assertions are enabled).
+Note that this function I<is> thread-safe, and the recommended way to use
+libev with threads is indeed to create one loop per thread, and using the
+default loop in the "main" or "initial" thread.
+
Example: Try to create a event loop that uses epoll and nothing else.
struct ev_loop *epoller = ev_loop_new (EVBACKEND_EPOLL | EVFLAG_NOENV);