delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/03/19/06:10:03

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
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" <robert DOT collins AT itdomain DOT com DOT au>
To: <cygwin-developers AT cygwin DOT com>
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
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" <robert DOT collins AT itdomain DOT com DOT au>
To: <cygwin-developers AT cygwin DOT com>
Sent: Monday, March 19, 2001 8:22 AM
Subject: Re: pthreads


> ----- Original Message -----
> From: "Chris Faylor" <cgf AT redhat DOT com>
> To: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
> Cc: <cygwin-developers AT cygwin DOT com>
> 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



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019