Date: Fri, 13 Jun 2003 09:28:21 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: Petri Helenius <pete@he.iki.fi> Cc: freebsd-threads@freebsd.org Subject: Re: fork semantics Message-ID: <3EE9FBA5.BFFC35DC@mindspring.com> References: <07fc01c331aa$41758cd0$812a40c1@PETEX31>
next in thread | previous in thread | raw e-mail | index | archive | help
Petri Helenius wrote: > Could somebody point me how fork is wrapped/implemented with libkse ? http://www.opengroup.org/onlinepubs/007904975/nfindex.html > Do all threads get duplicated and which would be the recommended way to > spin something off hanging on a pipe talking to one of the threads already in > existence? "A process shall be created with a single thread. If a multi-threaded process calls fork(), the new process shall contain a replica of the calling thread and its entire address space, possibly including the states of mutexes and other resources. Consequently, to avoid errors, the child process may only execute async-signal-safe operations until such time as one of the exec functions is called. [THR] Fork handlers may be established by means of the pthread_atfork() function in order to maintain application invariants across fork() calls. When the application calls fork() from a signal handler and any of the fork handlers registered by pthread_atfork() calls a function that is not asynch-signal-safe, the behavior is undefined." -- Terry
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3EE9FBA5.BFFC35DC>