On Apr 29 00:01, Takashi Yano wrote:
> On Thu, 28 Apr 2022 16:09:24 +0200
> Corinna Vinschen wrote:
> > On Apr 28 09:42, Ken Brown wrote:
> > > On 4/27/2022 10:13 AM, Takashi Yano wrote:
> > > > On Fri, 1 Apr 2022 17:45:51 +0900
> > > > Takashi Yano wrote:
> > > > > [...]
> > > > > diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
> > > > > index 62df96652..3824af199 100644
> > > > > --- a/winsup/cygwin/sigproc.cc
> > > > > +++ b/winsup/cygwin/sigproc.cc
> > > > > @@ -1325,6 +1325,10 @@ wait_sig (VOID *)
> > > > > _sig_tls = &_my_tls;
> > > > > bool sig_held = false;
> > > > > + /* Wait for _main_tls initialization. */
> > > > > + while (!cygwin_finished_initializing)
> > > > > + Sleep (10);
> > > > > +
> > > > > sigproc_printf ("entering ReadFile loop, my_readsig %p,
> > > > > my_sendsig %p",
> > > > > my_readsig, my_sendsig);
> > > > >
> > > > > I guess _main_tls may not be initialized correctly until
> > > > > cygwin_finished_initializing is set.
> > > > >
> > > > > Any comments would be appreciated.
> > >
> > > This seems reasonable to me.
>
> Thanks Ken and Corinna.
>
> > Missed that, sorry. I agree this seems reasonable, but wouldn't it be
> > cleaner if we *start* wait_sig only after cygwin_finished_initializing
> > is set to true?
>
> I also thought so, however, there is a comment in dcrt0.cc
> as follows. So, there seems to be some reason to start
> wait_sig before cygwin_finished_initialization.
>
> /* Initialize signal processing here, early, in the hopes that the creation
> of a thread early in the process will cause more predictability in memory
> layout for the main thread. */
> if (!dynamically_loaded)
> sigproc_init ();
This is a 32-bit only problem. The 64 bit address space layout is as
predictable as can be. Maybe the above fix should go into 3.3 and for
3.4 we try differently?
Corinna
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple