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

Comparing libev/ev.pod (file contents):
Revision 1.121 by root, Mon Jan 28 12:13:54 2008 UTC vs.
Revision 1.122 by root, Thu Jan 31 13:10:56 2008 UTC

774=item C<EV_FORK> 774=item C<EV_FORK>
775 775
776The event loop has been resumed in the child process after fork (see 776The event loop has been resumed in the child process after fork (see
777C<ev_fork>). 777C<ev_fork>).
778 778
779=item C<EV_ASYNC>
780
781The given async watcher has been asynchronously notified (see C<ev_async>).
782
779=item C<EV_ERROR> 783=item C<EV_ERROR>
780 784
781An unspecified error has occured, the watcher has been stopped. This might 785An unspecified error has occured, the watcher has been stopped. This might
782happen because the watcher could not be properly started because libev 786happen because the watcher could not be properly started because libev
783ran out of memory, a file descriptor was found to be closed or any other 787ran out of memory, a file descriptor was found to be closed or any other
2046believe me. 2050believe me.
2047 2051
2048=back 2052=back
2049 2053
2050 2054
2055=head2 C<ev_async> - how to wake up another event loop
2056
2057In general, you cannot use an C<ev_loop> from multiple threads or other
2058asynchronous sources such as signal handlers (as opposed to multiple event
2059loops - those are of course safe to use in different threads).
2060
2061Sometimes, however, you need to wake up another event loop you do not
2062control, for example because it belongs to another thread. This is what
2063C<ev_async> watchers do: as long as the C<ev_async> watcher is active, you
2064can signal it by calling C<ev_async_send>, which is thread- and signal
2065safe.
2066
2067This functionality is very similar to C<ev_signal> watchers, as signals,
2068too, are asynchronous in nature, and signals, too, will be compressed
2069(i.e. the number of callback invocations may be less than the number of
2070C<ev_async_sent> calls).
2071
2072Unlike C<ev_signal> watchers, C<ev_async> works with any event loop, not
2073just the default loop.
2074
2075=head3 Watcher-Specific Functions and Data Members
2076
2077=over 4
2078
2079=item ev_async_init (ev_async *, callback)
2080
2081Initialises and configures the async watcher - it has no parameters of any
2082kind. There is a C<ev_asynd_set> macro, but using it is utterly pointless,
2083believe me.
2084
2085=item ev_async_send (loop, ev_async *)
2086
2087Sends/signals/activates the given C<ev_async> watcher, that is, feeds
2088an C<EV_ASYNC> event on the watcher into the event loop. Unlike
2089C<ev_feed_event>, this call is safe to do in other threads, signal or
2090similar contexts (see the dicusssion of C<EV_ATOMIC_T> in the embedding
2091section below on what exactly this means).
2092
2093This call incurs the overhead of a syscall only once per loop iteration,
2094so while the overhead might be noticable, it doesn't apply to repeated
2095calls to C<ev_async_send>.
2096
2097=back
2098
2099
2051=head1 OTHER FUNCTIONS 2100=head1 OTHER FUNCTIONS
2052 2101
2053There are some other functions of possible interest. Described. Here. Now. 2102There are some other functions of possible interest. Described. Here. Now.
2054 2103
2055=over 4 2104=over 4

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines