[olsr-dev] fork() in main kills plugin's threads

Jens Nachtigall (spam-protected)
Sun Dec 19 01:25:42 CET 2004


olsrd itself does not use threads, but the dyn_gw does. I noticed that 
the dyn_gw works okay if olsrd is not forking (i.e. -d option is set 
for debugging). If olsrd forks (ie no -d option) then the pthread 
created by dyn_gw ,before the fork happens, seems to be killed.

I searched the web and this seems to be caused by libpthread and libc6 
both offering a fork() call, but libpthread's one is reentrant but 
libc6 not.

http://lists.wxwidgets.org/archive/wx-users/msg10470.html suggest to 
compile stuff with " -D_REENTRANT ". However, this does not help.

I know, I could simply always create a new pthread whenever the plugin's 
function is scheduled, so creating the pthread after fork() (this would 
be suboptimal, but would not also hurt much). However, that fork() 
kills the pthreads seems odd to me, any ideas on how to change this?

BTW: register_olsr_param is called before olsr_plugin_init(). Since one 
might want to set some default values in olsr_plugin_init, it should be 
vice versa imho.


More information about the Olsr-dev mailing list