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

Comparing libev/ev.pod (file contents):
Revision 1.357 by root, Tue Jan 11 02:15:58 2011 UTC vs.
Revision 1.360 by root, Mon Jan 17 12:11:12 2011 UTC

441when you want to receive them. 441when you want to receive them.
442 442
443This behaviour is useful when you want to do your own signal handling, or 443This behaviour is useful when you want to do your own signal handling, or
444want to handle signals only in specific threads and want to avoid libev 444want to handle signals only in specific threads and want to avoid libev
445unblocking the signals. 445unblocking the signals.
446
447It's also required by POSIX in a threaded program, as libev calls
448C<sigprocmask>, whose behaviour is officially unspecified.
446 449
447This flag's behaviour will become the default in future versions of libev. 450This flag's behaviour will become the default in future versions of libev.
448 451
449=item C<EVBACKEND_SELECT> (value 1, portable select backend) 452=item C<EVBACKEND_SELECT> (value 1, portable select backend)
450 453
1618always get a readiness notification instantly, and your read (or possibly 1621always get a readiness notification instantly, and your read (or possibly
1619write) will still block on the disk I/O. 1622write) will still block on the disk I/O.
1620 1623
1621Another way to view it is that in the case of sockets, pipes, character 1624Another way to view it is that in the case of sockets, pipes, character
1622devices and so on, there is another party (the sender) that delivers data 1625devices and so on, there is another party (the sender) that delivers data
1623on it's own, but in the case of files, there is no such thing: the disk 1626on its own, but in the case of files, there is no such thing: the disk
1624will not send data on it's own, simply because it doesn't know what you 1627will not send data on its own, simply because it doesn't know what you
1625wish to read - you would first have to request some data. 1628wish to read - you would first have to request some data.
1626 1629
1627Since files are typically not-so-well supported by advanced notification 1630Since files are typically not-so-well supported by advanced notification
1628mechanism, libev tries hard to emulate POSIX behaviour with respect 1631mechanism, libev tries hard to emulate POSIX behaviour with respect
1629to files, even though you should not use it. The reason for this is 1632to files, even though you should not use it. The reason for this is
2300=head3 The special problem of inheritance over fork/execve/pthread_create 2303=head3 The special problem of inheritance over fork/execve/pthread_create
2301 2304
2302Both the signal mask (C<sigprocmask>) and the signal disposition 2305Both the signal mask (C<sigprocmask>) and the signal disposition
2303(C<sigaction>) are unspecified after starting a signal watcher (and after 2306(C<sigaction>) are unspecified after starting a signal watcher (and after
2304stopping it again), that is, libev might or might not block the signal, 2307stopping it again), that is, libev might or might not block the signal,
2305and might or might not set or restore the installed signal handler. 2308and might or might not set or restore the installed signal handler (but
2309see C<EVFLAG_NOSIGMASK>).
2306 2310
2307While this does not matter for the signal disposition (libev never 2311While this does not matter for the signal disposition (libev never
2308sets signals to C<SIG_IGN>, so handlers will be reset to C<SIG_DFL> on 2312sets signals to C<SIG_IGN>, so handlers will be reset to C<SIG_DFL> on
2309C<execve>), this matters for the signal mask: many programs do not expect 2313C<execve>), this matters for the signal mask: many programs do not expect
2310certain signals to be blocked. 2314certain signals to be blocked.
3504 exit_main_loop = exit_nested_loop = 1; 3508 exit_main_loop = exit_nested_loop = 1;
3505 3509
3506=head2 THREAD LOCKING EXAMPLE 3510=head2 THREAD LOCKING EXAMPLE
3507 3511
3508Here is a fictitious example of how to run an event loop in a different 3512Here is a fictitious example of how to run an event loop in a different
3509thread than where callbacks are being invoked and watchers are 3513thread from where callbacks are being invoked and watchers are
3510created/added/removed. 3514created/added/removed.
3511 3515
3512For a real-world example, see the C<EV::Loop::Async> perl module, 3516For a real-world example, see the C<EV::Loop::Async> perl module,
3513which uses exactly this technique (which is suited for many high-level 3517which uses exactly this technique (which is suited for many high-level
3514languages). 3518languages).

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines