X-Git-Url: https://git.llucax.com/software/libev.git/blobdiff_plain/ea42db4da534aff7a623b651d9287644837b32e2..f2f56d433ed4bf97e96e4d1df5fb9f3795b768b3:/ev.html?ds=inline diff --git a/ev.html b/ev.html index 4ded676..993371e 100644 --- a/ev.html +++ b/ev.html @@ -6,7 +6,7 @@ - +
@@ -28,7 +28,7 @@Libev is an event loop: you register interest in certain events (such as a file descriptor being readable or a timeout occuring), and it will manage -these event sources and provide your program events.
+these event sources and provide your program with events.To do this, it must take more or less complete control over your process (or thread) by executing the event loop handler, and will then communicate events via a callback mechanism.
@@ -73,7 +73,9 @@ watcher. kqueue mechanisms for file descriptor events, relative timers, absolute timers with customised rescheduling, signal events, process status change events (related to SIGCHLD), and event watchers dealing with the event -loop mechanism itself (idle, prepare and check watchers). +loop mechanism itself (idle, prepare and check watchers). It also is quite +fast (see a http://libev.schmorp.de/bench.html (benchmark) comparing it +to libevent).Libev represents time as a single floating point number. This type is +
Libev represents time as a single floating point number, representing the
+(fractional) number of seconds since the (POSIX) epoch (somewhere near
+the beginning of 1970, details are complicated, don't ask). This type is
called ev_tstamp
, which is what you should use too. It usually aliases
to the double type in C.
ev_<type>_stop (loop, watcher *)
As long as your watcher is active (has been started but not stopped) you must not touch the values stored in it. Most specifically you must never reinitialise it or call its set method.
-You cna check wether an event is active by calling the ev_is_active
-(watcher *)
macro. To see wether an event is outstanding (but the
+
You cna check whether an event is active by calling the ev_is_active
+(watcher *)
macro. To see whether an event is outstanding (but the
callback for it has not been called yet) you cna use the ev_is_pending
(watcher *)
macro.
Each and every callback receives the event loop pointer as first, the @@ -422,7 +426,7 @@ information given in the last section.
I/O watchers check wether a file descriptor is readable or writable +
I/O watchers check whether a file descriptor is readable or writable in each iteration of the event loop (This behaviour is called level-triggering because you keep receiving events as long as the condition persists. Remember you cna stop the watcher if you don't want to @@ -480,8 +484,8 @@ the timer, and again will automatically restart it if need be.
Periodic watchers are also timers of a kind, but they are very versatile (and unfortunately a bit complex).
Unlike ev_timer's, they are not based on real time (or relative time)