Fork watcher will not be called if fork() is invoked in prepare watcher callback.
LeeXiaolan+libev at gmail.com
Thu May 1 10:33:40 CEST 2014
Considering this scenario, loop_init called without EVFLAG_FORKCHECK,
then register some fork and prepare watchers and start them. At a
certain point, in prepare watcher callback fork() is called, and in
child process ev_loop_fork() is also called honestly. Oops, the
callbacks of fork watcher will never be fired.
According to the source code, ev_loop_fork() just set a flag
postfork=1, and the following loop_fork() call clears this flag before
the next loop until which fork watchers are examined.
Is this behavior is intended with any considerations or a bug?
More information about the libev