[M3devel] cvsup
Olaf Wagner
wagner at elegosoft.com
Wed Mar 17 10:19:59 CET 2010
Quoting Daniel Solaz <m3 at sol42.com>:
> On 16 Mar 2010, at 20:32, Tony Hosking wrote:
>> fork should still work with pthreads. Why wouldn't it?
> Chapter 6.1 of Butenhof's pthreads book deals with this, and well,
> it is a mess. According to him only the calling thread exists on
> return from fork() in the child process, but the other pthread
> *states* (mutexes, conditions, data keys, etc.) are replicated as
> well. And I'm sure the details vary from system to system.
> This is the chapter's first sentence: "Avoid using fork in a
> threaded program (if you can) unless you intend to exec a new
> program immediately."
Is this about kernel threads or user level threads? Or about a specific
implementation of one or the other?
I don't know the book, but I always thought about pthreads as being the
POSIX specification of threads, and I don't think there's anything
in that relating to fork, AFAIR, but that was years ago.
Can anyone enlighten us about the POSIX specs and if they define the
semantics of fork in presence of threaded processes? Or does it really
boil down to the above `avoid it if you can'?
Olaf
--
Olaf Wagner -- elego Software Solutions GmbH
Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23 45 86 96 mobile: +49 177 2345 869 fax: +49 30 23 45 86 95
http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelregister: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194
More information about the M3devel
mailing list