--- libev/ev.pod 2008/02/01 13:43:38 1.125 +++ libev/ev.pod 2008/02/06 18:34:24 1.130 @@ -2080,7 +2080,8 @@ need elaborate support such as pthreads. That means that if you want to queue data, you have to provide your own -queue. And here is how you would implement locking: +queue. But at least I can tell you would implement locking around your +queue: =over 4 @@ -2127,7 +2128,7 @@ The strategy for threads is different, as you cannot (easily) block threads but you can easily preempt them, so to queue safely you need to -emply a traditional mutex lock, such as in this pthread example: +employ a traditional mutex lock, such as in this pthread example: static ev_async mysig; static pthread_mutex_t mymutex = PTHREAD_MUTEX_INITIALIZER; @@ -2697,11 +2698,13 @@ =item EV_ATOMIC_T Libev requires an integer type (suitable for storing C<0> or C<1>) whose -access is atomic with respect to other threads or signal contexts. No such type -is easily found using, so you cna provide your own type that you know is safe. +access is atomic with respect to other threads or signal contexts. No such +type is easily found in the C language, so you can provide your own type +that you know is safe for your purposes. It is used both for signal handler "locking" +as well as for signal and thread safety in C watchers. In the absense of this define, libev will use C -from F, which is usually good enough on most platforms. +(from F), which is usually good enough on most platforms. =item EV_H @@ -2912,11 +2915,11 @@ That means that changing a timer costs less than removing/adding them as only the relative motion in the event queue has to be paid for. -=item Starting io/check/prepare/idle/signal/child watchers: O(1) +=item Starting io/check/prepare/idle/signal/child/fork/async watchers: O(1) These just add the watcher into an array or at the head of a list. -=item Stopping check/prepare/idle watchers: O(1) +=item Stopping check/prepare/idle/fork/async watchers: O(1) =item Stopping an io/signal/child watcher: O(number_of_watchers_for_this_(fd/signal/pid % EV_PID_HASHSIZE)) @@ -2942,7 +2945,17 @@ Priorities are implemented by allocating some space for each priority. When doing priority-based operations, libev usually has to linearly search all the priorities, but starting/stopping and activating -watchers becomes O(1) w.r.t. prioritiy handling. +watchers becomes O(1) w.r.t. priority handling. + +=item Sending an ev_async: O(1) + +=item Processing ev_async_send: O(number_of_async_watchers) + +=item Processing signals: O(max_signal_number) + +Sending involves a syscall I there were no other C +calls in the current loop iteration. Checking for async and signal events +involves iterating over all running async watchers or all signal numbers. =back