On Thu, 3 Apr 2025 10:01:07 -0700 (PDT)
Jeremy Drake wrote:
> On Thu, 3 Apr 2025, Johannes Schindelin wrote:
> 
> > I still have a question that I would like to be answered in the commit
> > message, too:
> >
> > If `signal_arrived` is only initialized in `fixup_after_fork()` but user
> > callbacks that use this are called by `atforkchild()`, why did this not
> > trigger _all the time_ before your reordering of the calls?
> 
> Based on my recollections, Takashi probably knows better
> 
> 1) there has to be a pthread_atfork child callback registered
> 2) this callback has to call raw_write
> 3) raw_write now calls cygwait (which is now reenterancy-safe due to other
> fallout from this)
> 4) cygwait allows signals to be processed, so needs the signal-handling
> stuff to be properly initialized.
> 
> I'm guessing, if raw_write doesn't need to wait (ie, there's room in the
> pipe for the write) it doesn't hit the signal stuff.

Thanks for the explanation. Actually, cygwait() waits for a mutex at the
beginning of raw_write(). This is introduced by the commit 7ed9adb356df,
so the bug does not affect before that commit.

> But I get your request for explaining the scenario in the commit message.

I'll add the descriptions requested by Johannes before push. Thanks!

-- 
Takashi Yano <takashi.y...@nifty.ne.jp>

Reply via email to