… | |
… | |
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 | |
… | |
… | |
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 | |