… | |
… | |
374 | |
374 | |
375 | =item C<EVFLAG_SIGNALFD> |
375 | =item C<EVFLAG_SIGNALFD> |
376 | |
376 | |
377 | When this flag is specified, then libev will attempt to use the |
377 | When this flag is specified, then libev will attempt to use the |
378 | I<signalfd> API for it's C<ev_signal> (and C<ev_child>) watchers. This API |
378 | I<signalfd> API for it's C<ev_signal> (and C<ev_child>) watchers. This API |
379 | delivers signals synchronously, which makes is both faster and might make |
379 | delivers signals synchronously, which makes it both faster and might make |
380 | it possible to get the queued signal data. |
380 | it possible to get the queued signal data. It can also simplify signal |
|
|
381 | handling with threads, as long as you properly block signals in your |
|
|
382 | threads that are not interested in handling them. |
381 | |
383 | |
382 | Signalfd will not be used by default as this changes your signal mask, and |
384 | Signalfd will not be used by default as this changes your signal mask, and |
383 | there are a lot of shoddy libraries and programs (glib's threadpool for |
385 | there are a lot of shoddy libraries and programs (glib's threadpool for |
384 | example) that can't properly initialise their signal masks. |
386 | example) that can't properly initialise their signal masks. |
385 | |
387 | |
… | |
… | |
1865 | Returns the remaining time until a timer fires. If the timer is active, |
1867 | Returns the remaining time until a timer fires. If the timer is active, |
1866 | then this time is relative to the current event loop time, otherwise it's |
1868 | then this time is relative to the current event loop time, otherwise it's |
1867 | the timeout value currently configured. |
1869 | the timeout value currently configured. |
1868 | |
1870 | |
1869 | That is, after an C<ev_timer_set (w, 5, 7)>, C<ev_timer_remaining> returns |
1871 | That is, after an C<ev_timer_set (w, 5, 7)>, C<ev_timer_remaining> returns |
1870 | C<5>. When the timer is started and one second passes, C<ev_timer_remain> |
1872 | C<5>. When the timer is started and one second passes, C<ev_timer_remaining> |
1871 | will return C<4>. When the timer expires and is restarted, it will return |
1873 | will return C<4>. When the timer expires and is restarted, it will return |
1872 | roughly C<7> (likely slightly less as callback invocation takes some time, |
1874 | roughly C<7> (likely slightly less as callback invocation takes some time, |
1873 | too), and so on. |
1875 | too), and so on. |
1874 | |
1876 | |
1875 | =item ev_tstamp repeat [read-write] |
1877 | =item ev_tstamp repeat [read-write] |
… | |
… | |
2160 | In current versions of libev, the signal will not be blocked indefinitely |
2162 | In current versions of libev, the signal will not be blocked indefinitely |
2161 | unless you use the C<signalfd> API (C<EV_SIGNALFD>). While this reduces |
2163 | unless you use the C<signalfd> API (C<EV_SIGNALFD>). While this reduces |
2162 | the window of opportunity for problems, it will not go away, as libev |
2164 | the window of opportunity for problems, it will not go away, as libev |
2163 | I<has> to modify the signal mask, at least temporarily. |
2165 | I<has> to modify the signal mask, at least temporarily. |
2164 | |
2166 | |
2165 | So I can't stress this enough I<if you do not reset your signal mask |
2167 | So I can't stress this enough: I<If you do not reset your signal mask when |
2166 | when you expect it to be empty, you have a race condition in your |
2168 | you expect it to be empty, you have a race condition in your code>. This |
2167 | program>. This is not a libev-specific thing, this is true for most event |
2169 | is not a libev-specific thing, this is true for most event libraries. |
2168 | libraries. |
|
|
2169 | |
2170 | |
2170 | =head3 Watcher-Specific Functions and Data Members |
2171 | =head3 Watcher-Specific Functions and Data Members |
2171 | |
2172 | |
2172 | =over 4 |
2173 | =over 4 |
2173 | |
2174 | |
… | |
… | |
3450 | Erkki Seppala has written Ocaml bindings for libev, to be found at |
3451 | Erkki Seppala has written Ocaml bindings for libev, to be found at |
3451 | L<http://modeemi.cs.tut.fi/~flux/software/ocaml-ev/>. |
3452 | L<http://modeemi.cs.tut.fi/~flux/software/ocaml-ev/>. |
3452 | |
3453 | |
3453 | =item Lua |
3454 | =item Lua |
3454 | |
3455 | |
3455 | Brian Maher has written a partial interface to libev |
3456 | Brian Maher has written a partial interface to libev for lua (at the |
3456 | for lua (only C<ev_io> and C<ev_timer>), to be found at |
3457 | time of this writing, only C<ev_io> and C<ev_timer>), to be found at |
3457 | L<http://github.com/brimworks/lua-ev>. |
3458 | L<http://github.com/brimworks/lua-ev>. |
3458 | |
3459 | |
3459 | =back |
3460 | =back |
3460 | |
3461 | |
3461 | |
3462 | |