delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/15/21:20:22

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <013b01c0c613$53cdac00$0200a8c0@lifelesswks>
From: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
To: <cygwin AT cygwin DOT com>
References: <037701c0c3ab$9049bf30$0200a8c0 AT lifelesswks> <20010413221222 DOT C5606 AT dothill DOT com> <006001c0c4af$179b79c0$0200a8c0 AT lifelesswks> <20010414223139 DOT A906 AT redhat DOT com> <001701c0c557$02a861b0$0200a8c0 AT lifelesswks> <20010415090600 DOT A8359 AT redhat DOT com> <001301c0c5af$9cb7e520$0200a8c0 AT lifelesswks> <20010415153317 DOT C9015 AT redhat DOT com>
Subject: Re: fork expert needed: (was Re: pthreads update for the adventurous)
Date: Mon, 16 Apr 2001 11:19:46 +1000
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: 16 Apr 2001 01:12:29.0258 (UTC) FILETIME=[4E599AA0:01C0C612]

----- Original Message -----
From: "Christopher Faylor" <cgf AT redhat DOT com>
To: <cygwin AT cygwin DOT com>
Sent: Monday, April 16, 2001 5:33 AM
Subject: Re: fork expert needed: (was Re: pthreads update for the
adventurous)


> On Sun, Apr 15, 2001 at 11:25:58PM +1000, Robert Collins wrote:
> >
> >
> >----- Original Message -----
> >From: "Christopher Faylor" <cgf AT redhat DOT com>
> >To: <cygwin AT cygwin DOT com>
> >Sent: Sunday, April 15, 2001 11:06 PM
> >Subject: Re: fork expert needed: (was Re: pthreads update for the
> >adventurous)
> >
> >
> >> On Sun, Apr 15, 2001 at 12:51:44PM +1000, Robert Collins wrote:
> >>>>I added this dll relocation stuff last year to help with perl.  It
> >>>>wasn't fun.
> >>>
> >>>Oh.  Well I infer that it only occurs with threads enabled in
python,
> >>>or Jason wouldn't be telling us.  Any hints Chris for possible
> >>>races/locks that might prevent the child doing the relocation if
the
> >>>parent has active threads ?
> >>
> >>I believe the relocation happens during DLL initialization when all
> >>other threads are suspended.
> >>
> >>cgf
> >>
> >
> >fork() doesn't suspend all the threads in the parent.  The thread
doing
> >the call blocks, and the child is started with only one thread.  I
> >don't believe all the threads are meant to be suspended under posix
> >threads either - but I'll look into this.
>
> Let me say this again:
>
> "I believe the relocation happens during DLL initialization when all
> other threads are suspended."
>
> Please read up on MSDN on what happens during DLL initialization with
> threads and stuff.  This isn't a Cygwin thing, it's a windows thing.
>
> cgf
>

I've reread DLL initialisation stuff.

The fork_child function is not a DLL entry point for cygwin1.dll. Also
while MSDN states that only one thread at a time can call the entry
point function, it does not state or imply that other threads are
suspended during that process.
Finally dll_list::load_after_fork calls LoadLibraryEx which dll entry
point functions are not allowed to call.
Mind you as I don't know understand how you create the new pid during
fork I'm still going blind here.

I don't have time to do anything indepth today, but I hope to get time
later in the week . My testcase will be to
compile cygwin with DEBUGGING and set a fork delay of 5 seconds.

write a test prog that
a) starts a new thread that writes "1\n" "2\n" etc via printf.
b) forks from the main thread.

if the 1\n2\n3\n.. pause then cygwin may have an internal mutex on
system functions, and I'll do a second case using win32 only functions
in the second thread.
If as I suspect the 1\n2\n3\n don't pause the point is demonstrated..

Rob




--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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