Hi Fabio, I'd call this a 'pass 1' patch.
* This makes your test program work. * This does not cause a regression with the existing logsys test cases in the openais trunk. It, however, dirties up the build system because it requires changing the linking order (logsys now needs -lpthread after it. For some reason, it didn't before (despite using other pthread APIs); someone probably knows why - as well as the correct way to fix it within the context of the openais build system. It would be *potentially* cleaner to make the child "cleanup" function an explicitly-called function, but probably less nice from a user API perspective. Basically, pthread_atfork() makes it a pretty simple thing since the user doesn't need to do anything in the child process (I think pthread_atfork was primarily designed for use in threaded APIs, anyway). Minimally, we needed to zap the mutexes and the thread indicators (since there's no threads in the child process... yet). Upon further investigation, I noticed a double-lock when doing _log_printf around the config mutex (_log_printf does a lock and so does log_printf_worker_fn, causing the child to hang on itself). To remedy this, I added a check for logsys_wthread_active (which will be 0 in the child process unless a full reinitialization is done) - but I'm not sure if this is the right thing to do or not. -- Lon
_______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
