Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com Message-ID: <00f401c0b064$f3a15a70$0200a8c0@lifelesswks> From: "Robert Collins" To: References: <002701c0af7c$fac67710$0200a8c0 AT lifelesswks> <20010318120654 DOT C12880 AT redhat DOT com> <007f01c0aff1$9889f110$0200a8c0 AT lifelesswks> Subject: Re: pthreads Date: Mon, 19 Mar 2001 22:08:27 +1100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-OriginalArrivalTime: 19 Mar 2001 11:02:59.0971 (UTC) FILETIME=[29225D30:01C0B064] ----- Original Message ----- From: "Robert Collins" To: Sent: Monday, March 19, 2001 8:22 AM Subject: Re: pthreads > ----- Original Message ----- > From: "Chris Faylor" > To: "Robert Collins" > Cc: > Sent: Monday, March 19, 2001 4:06 AM > Subject: Re: pthreads > > >Thread state should not be copied since fork does not duplicate threads. I've gone and done my homework :] http://www.opengroup.org/onlinepubs/007908799/xsh/fork.html "A process is created with a single thread. If a multi-threaded process calls fork(), the new process contains 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. Fork handlers may be established by means of the pthread_atfork() function in order to maintain application invariants across fork() calls. " So the current behaviour _is correct_. I'm not 100% sure we follow the calling thread's state rather than the mainthreads state, but I'll look into that. I'll look into an implementation of the pthread_atfork stuff next weekend I think (hey may as well get on a roll with this stuff). > Thanks, the opengroup specs don'y mention fork/thread interaction in the > thread call documentation - which is why I asked. (but I found that they do under fork(). :]) > Does > > linux duplicate every thread in a forked child? > > I'll go read. No. See above. Rob