On Monday 02 March 2009 03:57:34 Michael Schnell wrote: > > You should not do _anything_ with threads in a vfork child. > > pthread_self() is not safe. Thread-local variables are not safe to > > acccess. > > Hmm, I suppose, in a non-MMU system, any user process is started by the > shell using vfork(), So obvious there are situations where you are > allowed to do threads in a vfork child. If you claim you need to do > precautions do allow for threads, you need to do this for any program > you start (doing vfork(); exec();) as you can't know if this program > does threads.
he means calling threading functions in the child of a vfork() is not safe. having threads run otherwise is irrelevant. > Of course if you use vfork and don't do *exec(), you need to be very > careful, but in fact I don't see when I should do this. To create > threads I suppose I'd better use the pthread library instead of doing > vfork() (or fork() or clone() ) in the user code. attempting to mimic threading with vfork/clone is a useless exercise and completely not portable. there are at least 4 calling conventions with clone depending on the arch you're running on. hell, few people even understand the clone semantics and complete implications that go on inside of the pthread library let alone create their own version. -mike
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ uClinux-dev mailing list uClinux-dev@uclinux.org http://mailman.uclinux.org/mailman/listinfo/uclinux-dev This message was resent by uclinux-dev@uclinux.org To unsubscribe see: http://mailman.uclinux.org/mailman/options/uclinux-dev