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

Comparing libev/ev.pod (file contents):
Revision 1.207 by root, Tue Oct 28 14:13:52 2008 UTC vs.
Revision 1.208 by root, Wed Oct 29 10:24:23 2008 UTC

298If you don't know what event loop to use, use the one returned from this 298If you don't know what event loop to use, use the one returned from this
299function. 299function.
300 300
301Note that this function is I<not> thread-safe, so if you want to use it 301Note that this function is I<not> thread-safe, so if you want to use it
302from multiple threads, you have to lock (note also that this is unlikely, 302from multiple threads, you have to lock (note also that this is unlikely,
303as loops cannot bes hared easily between threads anyway). 303as loops cannot be shared easily between threads anyway).
304 304
305The default loop is the only loop that can handle C<ev_signal> and 305The default loop is the only loop that can handle C<ev_signal> and
306C<ev_child> watchers, and to do this, it always registers a handler 306C<ev_child> watchers, and to do this, it always registers a handler
307for C<SIGCHLD>. If this is a problem for your application you can either 307for C<SIGCHLD>. If this is a problem for your application you can either
308create a dynamic loop with C<ev_loop_new> that doesn't do that, or you 308create a dynamic loop with C<ev_loop_new> that doesn't do that, or you
647the loop. 647the loop.
648 648
649A flags value of C<EVLOOP_ONESHOT> will look for new events (waiting if 649A flags value of C<EVLOOP_ONESHOT> will look for new events (waiting if
650necessary) and will handle those and any already outstanding ones. It 650necessary) and will handle those and any already outstanding ones. It
651will block your process until at least one new event arrives (which could 651will block your process until at least one new event arrives (which could
652be an event internal to libev itself, so there is no guarentee that a 652be an event internal to libev itself, so there is no guarantee that a
653user-registered callback will be called), and will return after one 653user-registered callback will be called), and will return after one
654iteration of the loop. 654iteration of the loop.
655 655
656This is useful if you are waiting for some external event in conjunction 656This is useful if you are waiting for some external event in conjunction
657with something not expressible using other libev watchers (i.e. "roll your 657with something not expressible using other libev watchers (i.e. "roll your
1943to see if it changed somehow. You can specify a recommended polling 1943to see if it changed somehow. You can specify a recommended polling
1944interval for this case. If you specify a polling interval of C<0> (highly 1944interval for this case. If you specify a polling interval of C<0> (highly
1945recommended!) then a I<suitable, unspecified default> value will be used 1945recommended!) then a I<suitable, unspecified default> value will be used
1946(which you can expect to be around five seconds, although this might 1946(which you can expect to be around five seconds, although this might
1947change dynamically). Libev will also impose a minimum interval which is 1947change dynamically). Libev will also impose a minimum interval which is
1948currently around C<0.1>, but thats usually overkill. 1948currently around C<0.1>, but that's usually overkill.
1949 1949
1950This watcher type is not meant for massive numbers of stat watchers, 1950This watcher type is not meant for massive numbers of stat watchers,
1951as even with OS-supported change notifications, this can be 1951as even with OS-supported change notifications, this can be
1952resource-intensive. 1952resource-intensive.
1953 1953
2643=over 4 2643=over 4
2644 2644
2645=item ev_async_init (ev_async *, callback) 2645=item ev_async_init (ev_async *, callback)
2646 2646
2647Initialises and configures the async watcher - it has no parameters of any 2647Initialises and configures the async watcher - it has no parameters of any
2648kind. There is a C<ev_asynd_set> macro, but using it is utterly pointless, 2648kind. There is a C<ev_async_set> macro, but using it is utterly pointless,
2649trust me. 2649trust me.
2650 2650
2651=item ev_async_send (loop, ev_async *) 2651=item ev_async_send (loop, ev_async *)
2652 2652
2653Sends/signals/activates the given C<ev_async> watcher, that is, feeds 2653Sends/signals/activates the given C<ev_async> watcher, that is, feeds
3086 3086
3087 #define EV_STANDALONE 1 3087 #define EV_STANDALONE 1
3088 #include "ev.h" 3088 #include "ev.h"
3089 3089
3090Both header files and implementation files can be compiled with a C++ 3090Both header files and implementation files can be compiled with a C++
3091compiler (at least, thats a stated goal, and breakage will be treated 3091compiler (at least, that's a stated goal, and breakage will be treated
3092as a bug). 3092as a bug).
3093 3093
3094You need the following files in your source tree, or in a directory 3094You need the following files in your source tree, or in a directory
3095in your include path (e.g. in libev/ when using -Ilibev): 3095in your include path (e.g. in libev/ when using -Ilibev):
3096 3096
3568loop, as long as you don't confuse yourself). The only exception is that 3568loop, as long as you don't confuse yourself). The only exception is that
3569you must not do this from C<ev_periodic> reschedule callbacks. 3569you must not do this from C<ev_periodic> reschedule callbacks.
3570 3570
3571Care has been taken to ensure that libev does not keep local state inside 3571Care has been taken to ensure that libev does not keep local state inside
3572C<ev_loop>, and other calls do not usually allow for coroutine switches as 3572C<ev_loop>, and other calls do not usually allow for coroutine switches as
3573they do not clal any callbacks. 3573they do not call any callbacks.
3574 3574
3575=head2 COMPILER WARNINGS 3575=head2 COMPILER WARNINGS
3576 3576
3577Depending on your compiler and compiler settings, you might get no or a 3577Depending on your compiler and compiler settings, you might get no or a
3578lot of warnings when compiling libev code. Some people are apparently 3578lot of warnings when compiling libev code. Some people are apparently
3612 ==2274== definitely lost: 0 bytes in 0 blocks. 3612 ==2274== definitely lost: 0 bytes in 0 blocks.
3613 ==2274== possibly lost: 0 bytes in 0 blocks. 3613 ==2274== possibly lost: 0 bytes in 0 blocks.
3614 ==2274== still reachable: 256 bytes in 1 blocks. 3614 ==2274== still reachable: 256 bytes in 1 blocks.
3615 3615
3616Then there is no memory leak, just as memory accounted to global variables 3616Then there is no memory leak, just as memory accounted to global variables
3617is not a memleak - the memory is still being refernced, and didn't leak. 3617is not a memleak - the memory is still being referenced, and didn't leak.
3618 3618
3619Similarly, under some circumstances, valgrind might report kernel bugs 3619Similarly, under some circumstances, valgrind might report kernel bugs
3620as if it were a bug in libev (e.g. in realloc or in the poll backend, 3620as if it were a bug in libev (e.g. in realloc or in the poll backend,
3621although an acceptable workaround has been found here), or it might be 3621although an acceptable workaround has been found here), or it might be
3622confused. 3622confused.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines