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

Comparing libeio/eio.pod (file contents):
Revision 1.5 by root, Sun Nov 29 15:53:48 2009 UTC vs.
Revision 1.6 by sf-exg, Tue May 31 10:09:38 2011 UTC

11The newest version of this document is also available as an html-formatted 11The newest version of this document is also available as an html-formatted
12web page you might find easier to navigate when reading it for the first 12web page you might find easier to navigate when reading it for the first
13time: L<http://pod.tst.eu/http://cvs.schmorp.de/libeio/eio.pod>. 13time: L<http://pod.tst.eu/http://cvs.schmorp.de/libeio/eio.pod>.
14 14
15Note that this library is a by-product of the C<IO::AIO> perl 15Note that this library is a by-product of the C<IO::AIO> perl
16module, and many of the subtler points regarding requets lifetime 16module, and many of the subtler points regarding requests lifetime
17and so on are only documented in its documentation at the 17and so on are only documented in its documentation at the
18moment: L<http://pod.tst.eu/http://cvs.schmorp.de/IO-AIO/AIO.pm>. 18moment: L<http://pod.tst.eu/http://cvs.schmorp.de/IO-AIO/AIO.pm>.
19 19
20=head2 FEATURES 20=head2 FEATURES
21 21
22This library provides fully asynchronous versions of most POSIX functions 22This library provides fully asynchronous versions of most POSIX functions
23dealign with I/O. Unlike most asynchronous libraries, this not only 23dealing with I/O. Unlike most asynchronous libraries, this not only
24includes C<read> and C<write>, but also C<open>, C<stat>, C<unlink> and 24includes C<read> and C<write>, but also C<open>, C<stat>, C<unlink> and
25similar functions, as well as less rarely ones such as C<mknod>, C<futime> 25similar functions, as well as less rarely ones such as C<mknod>, C<futime>
26or C<readlink>. 26or C<readlink>.
27 27
28It also offers wrappers around C<sendfile> (Solaris, Linux, HP-UX and 28It also offers wrappers around C<sendfile> (Solaris, Linux, HP-UX and
37=head2 TIME REPRESENTATION 37=head2 TIME REPRESENTATION
38 38
39Libeio represents time as a single floating point number, representing the 39Libeio represents time as a single floating point number, representing the
40(fractional) number of seconds since the (POSIX) epoch (somewhere near 40(fractional) number of seconds since the (POSIX) epoch (somewhere near
41the beginning of 1970, details are complicated, don't ask). This type is 41the beginning of 1970, details are complicated, don't ask). This type is
42called C<eio_tstamp>, but it is guarenteed to be of type C<double> (or 42called C<eio_tstamp>, but it is guaranteed to be of type C<double> (or
43better), so you can freely use C<double> yourself. 43better), so you can freely use C<double> yourself.
44 44
45Unlike the name component C<stamp> might indicate, it is also used for 45Unlike the name component C<stamp> might indicate, it is also used for
46time differences throughout libeio. 46time differences throughout libeio.
47 47
97handled or C<done_poll> has been called, which signals the same. 97handled or C<done_poll> has been called, which signals the same.
98 98
99Note that C<eio_poll> might return after C<done_poll> and C<want_poll> 99Note that C<eio_poll> might return after C<done_poll> and C<want_poll>
100have been called again, so watch out for races in your code. 100have been called again, so watch out for races in your code.
101 101
102As with C<want_poll>, this callback is called while lcoks are being held, 102As with C<want_poll>, this callback is called while locks are being held,
103so you I<must not call any libeio functions form within this callback>. 103so you I<must not call any libeio functions form within this callback>.
104 104
105=item int eio_poll () 105=item int eio_poll ()
106 106
107This function has to be called whenever there are pending requests that 107This function has to be called whenever there are pending requests that
126libev resets/rearms the async watcher before calling your callback, 126libev resets/rearms the async watcher before calling your callback,
127and therefore, before calling C<eio_poll>. This might result in (some) 127and therefore, before calling C<eio_poll>. This might result in (some)
128spurious wake-ups, but is generally harmless. 128spurious wake-ups, but is generally harmless.
129 129
130For most other event loops, you would typically use a pipe - the event 130For most other event loops, you would typically use a pipe - the event
131loop should be told to wait for read readyness on the read end. In 131loop should be told to wait for read readiness on the read end. In
132C<want_poll> you would write a single byte, in C<done_poll> you would try 132C<want_poll> you would write a single byte, in C<done_poll> you would try
133to read that byte, and in the callback for the read end, you would call 133to read that byte, and in the callback for the read end, you would call
134C<eio_poll>. The race is avoided here because the event loop should invoke 134C<eio_poll>. The race is avoided here because the event loop should invoke
135your callback again and again until the byte has been read (as the pipe 135your callback again and again until the byte has been read (as the pipe
136read callback does not read it, only C<done_poll>). 136read callback does not read it, only C<done_poll>).
185=item eio_set_max_idle (unsigned int nthreads) 185=item eio_set_max_idle (unsigned int nthreads)
186 186
187Libeio uses threads internally to handle most requests, and will start and stop threads on demand. 187Libeio uses threads internally to handle most requests, and will start and stop threads on demand.
188 188
189This call can be used to limit the number of idle threads (threads without 189This call can be used to limit the number of idle threads (threads without
190work to do): libeio will keep some threads idle in preperation for more 190work to do): libeio will keep some threads idle in preparation for more
191requests, but never longer than C<nthreads> threads. 191requests, but never longer than C<nthreads> threads.
192 192
193In addition to this, libeio will also stop threads when they are idle for 193In addition to this, libeio will also stop threads when they are idle for
194a few seconds, regardless of this setting. 194a few seconds, regardless of this setting.
195 195

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines