Ah well .. knew it couldn't be that easy:
~/felix>cat mystdout.log FLX WEB!!! listening on port 1234 spawning fthread to handle connection -1 ~/felix>cat mystderr.log Waiting for connection kevent returned code -1, errno=9 kevent add_kqueue_filter: Bad file descriptor FAILED TO SPAWN ACCEPT REQUEST got connection -1 Waiting for connection kevent returned code -1, errno=9 kevent add_kqueue_filter: Bad file descriptor FAILED TO SPAWN ACCEPT REQUEST Spawned fthread running for socket -1 Attempt to start_async_op on socket -1 This is on OSX. Has to have something to do with threads. Yeah, the kevent is somehow returning crap. It's running in a thread. I don't think Posix has the faintest idea what to do if there are threads running when one does a fork(). AFAIK on Linux, there is no such thing as a process, everything is a thread, so forking() just clones a thread, which means the other thread keeps running, but I'm not sure. I am guessing when the original process exits, the demux thread is getting an error return from kevent on process exit.. I have no idea what the daemon process would do without that thread running.. the address spaces of the two processes have to be the same (or fork couldn't possibly work), so the second thread has to be owned by the initial process which is now dying. I will have to put the daemonisation into flx_(a)run and make it happen *before* the demux thread is open. The problem is .. how do I *tell* it? Hmm .. it would be better if there was just a "daemon" command, so I could do daemon tools/webserver assuming static linkage or daemon flx_arun tools/webserver.so # or .dylib on on OSX which would basically just become a daemon and then exec the rest of the command.. hmm .. surely there's such a program already? -- john skaller skal...@users.sourceforge.net ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language