ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.pod
(Generate patch)

Comparing libev/ev.pod (file contents):
Revision 1.3 by root, Mon Nov 12 08:03:31 2007 UTC vs.
Revision 1.5 by root, Mon Nov 12 08:11:57 2007 UTC

8 8
9=head1 DESCRIPTION 9=head1 DESCRIPTION
10 10
11Libev is an event loop: you register interest in certain events (such as a 11Libev is an event loop: you register interest in certain events (such as a
12file descriptor being readable or a timeout occuring), and it will manage 12file descriptor being readable or a timeout occuring), and it will manage
13these event sources and provide your program events. 13these event sources and provide your program with events.
14 14
15To do this, it must take more or less complete control over your process 15To do this, it must take more or less complete control over your process
16(or thread) by executing the I<event loop> handler, and will then 16(or thread) by executing the I<event loop> handler, and will then
17communicate events via a callback mechanism. 17communicate events via a callback mechanism.
18 18
25 25
26Libev supports select, poll, the linux-specific epoll and the bsd-specific 26Libev supports select, poll, the linux-specific epoll and the bsd-specific
27kqueue mechanisms for file descriptor events, relative timers, absolute 27kqueue mechanisms for file descriptor events, relative timers, absolute
28timers with customised rescheduling, signal events, process status change 28timers with customised rescheduling, signal events, process status change
29events (related to SIGCHLD), and event watchers dealing with the event 29events (related to SIGCHLD), and event watchers dealing with the event
30loop mechanism itself (idle, prepare and check watchers). 30loop mechanism itself (idle, prepare and check watchers). It also is quite
31fast (see a L<http://libev.schmorp.de/bench.html|benchmark> comparing it
32to libevent).
31 33
32=head1 CONVENTIONS 34=head1 CONVENTIONS
33 35
34Libev is very configurable. In this manual the default configuration 36Libev is very configurable. In this manual the default configuration
35will be described, which supports multiple event loops. For more info 37will be described, which supports multiple event loops. For more info
293 295
294As long as your watcher is active (has been started but not stopped) you 296As long as your watcher is active (has been started but not stopped) you
295must not touch the values stored in it. Most specifically you must never 297must not touch the values stored in it. Most specifically you must never
296reinitialise it or call its set method. 298reinitialise it or call its set method.
297 299
298You cna check wether an event is active by calling the C<ev_is_active 300You cna check whether an event is active by calling the C<ev_is_active
299(watcher *)> macro. To see wether an event is outstanding (but the 301(watcher *)> macro. To see whether an event is outstanding (but the
300callback for it has not been called yet) you cna use the C<ev_is_pending 302callback for it has not been called yet) you cna use the C<ev_is_pending
301(watcher *)> macro. 303(watcher *)> macro.
302 304
303Each and every callback receives the event loop pointer as first, the 305Each and every callback receives the event loop pointer as first, the
304registered watcher structure as second, and a bitset of received events as 306registered watcher structure as second, and a bitset of received events as
400This section describes each watcher in detail, but will not repeat 402This section describes each watcher in detail, but will not repeat
401information given in the last section. 403information given in the last section.
402 404
403=head2 struct ev_io - is my file descriptor readable or writable 405=head2 struct ev_io - is my file descriptor readable or writable
404 406
405I/O watchers check wether a file descriptor is readable or writable 407I/O watchers check whether a file descriptor is readable or writable
406in each iteration of the event loop (This behaviour is called 408in each iteration of the event loop (This behaviour is called
407level-triggering because you keep receiving events as long as the 409level-triggering because you keep receiving events as long as the
408condition persists. Remember you cna stop the watcher if you don't want to 410condition persists. Remember you cna stop the watcher if you don't want to
409act on the event and neither want to receive future events). 411act on the event and neither want to receive future events).
410 412

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines