On Wed, Oct 27, 2010 at 5:58 PM, john skaller <skal...@users.sourceforge.net> wrote: > 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().
POSIX says that after fork() succeeds you get a child process with only one thread running. Trying to make sure that only the right resources are shared by the child is, um, challenging. > 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. Recent Linux is POSIX-compliant with respect to the separation between threads and processes, years ago each thread had a separate pid and various things were broken. By which I mean, even more broken than POSIX requires. > 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. At this point my Felix-ignorance kicks in, and I don't have a clue what's going on. -- James ------------------------------------------------------------------------------ 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