Bug? related to fork and pthreads
Dave Hylands
dhylands at gmail.com
Sun May 4 08:22:35 UTC 2008
Hi,
I've stumbled on what appears to be a problem with pthreads.
I'm using what I believe is a version of 0.9.29 with the
linuxthreads.old variant with libpthread as a shared library (it came
from Wind River - so I'm not 100% sure on the version).
If my program calls fork, then __pthread_reset_main_thread gets
called, and everything seems to behave correctly.
However, if my program calls daemon (which also calls fork) then
__pthread_reset_main_thread doesn't get called.
This causes pthread_create's which are called after daemon is called
to hang, since the wrong thread gets signalled.
pthread_create trys to signal the original initial thread which
existed before the daemon call was made.
I've done a kludge by having pthread_create do:
self->p_pid = getpid();
before sending the request which allows my program to work, but I'm
not sure what the correct fix should be.
--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/
More information about the uClibc
mailing list