On 01/10/2013 05:18 PM, Brandon Black wrote:
On Thu, Jan 10, 2013 at 10:05 AM, Bo Lorentsen <b...@lue.dk
<mailto:b...@lue.dk>> wrote:
The thing is ... this works amazingly, until I try to startup this
app as a daemon (fork). And yes, when i start it as i daemon i
make sure to call ev::post_fork(), and my default loop starts up
as it is supposed to (but later or lazy really), without any
problems (in its own libev thread), but it seems like any socket
connections made after the fork between ev::post_fork() and
ev::default_loop().run() are invalid after calling run.
You shouldn't even need post_fork() just to do daemonization. Just
daemonize first and then initialize libev stuff afterwards. My first
random guess at your problem would be that you're using some
daemonization library/code written by someone else, and that it closes
all open file descriptors during the process (a common programming
error in daemonization code). I've use libev in a ton of daemonized C
code without issue, as I'm sure many others have, so it's unlikely to
be a bug in libev.
Ok, I had some old code closing the first 4096 handlers after fork (I
have no idea as to why), after not doing this anymore, the original code
worked without the post_fork() call.
Thanks for your valuable advise, it now seems to work as expected, SSE
support here we come :-)
Regards
/BL
_______________________________________________
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev