From: Derek Upham <sand@blarg.net>
To: Andy Wingo <wingo@pobox.com>
Cc: guile-devel@gnu.org
Subject: Re: Cygwin port of Guile 2.2
Date: Fri, 14 Apr 2017 06:41:33 -0700 [thread overview]
Message-ID: <87pogft8c2.fsf@priss.frightenedpiglet.com> (raw)
In-Reply-To: <87lgr38jzd.fsf@pobox.com>
Andy Wingo <wingo@pobox.com> writes:
> I guess the new thing being the finalizer thread? In theory before the
> fork, Guile will stop the finalizer thread. If that's not working, that
> could be it.
>
> Another option would be to disable fork() but only if Guile is built
> with threads. Actually this is probably better -- I bet there are Guile
> people that expect to be able to fork on Cygwin and would be OK if their
> Guile had no threads.
>
> Please feel free to push to master once there are adequate comments.
> Someone will come later and want to enable fork() on Cygwin with threads
> and will need to know why it's disabled and what they could do to fix it
> :)
There’s the finalizer thread, but there’s also the signal delivery
thread. The “sigaction” code ensures that signal delivery thread is
running. And note that “primitive-fork” is supposed to display a
warning if you are forking with outstanding threads, but it explicitly
ignores the signal delivery thread during its check.
I have found that what actually hangs after a fork are the mutexes
supporting the threads: they are kernel-level resources, referenced by
ID, and end up being shared between parent and child.
I’m baking a fix that wipes out user signals before calling
“primitve-fork”, and then restores them separately in the parent and
child processes. Doing so gives them different mutexes. It required
some support in scmsigs.c to:
- Have “restore-signals” return a description of the signal handlers,
that we can use to restore those handlers.
- Have “restore-signals” close the signal pipe (which kills the signal
delivery thread).
- When closing the signal pipe, wait for the signal delivery thread to
exit.
I don’t think there’s any safe way to restore the finalizer thread and
support SCSH-style (begin ...) process forms. Shutting down the
finalizer thread is the best we can do.
All of this is on GNU/Linux, of course, not Cygwin.
Derek
--
Derek Upham
sand@blarg.net
next prev parent reply other threads:[~2017-04-14 13:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-04 16:45 Cygwin port of Guile 2.2 Mike Gran
2017-04-04 17:03 ` Eli Zaretskii
2017-04-14 8:35 ` Andy Wingo
2017-04-14 13:41 ` Derek Upham [this message]
2017-04-17 8:04 ` Andy Wingo
2017-04-17 15:05 ` Derek Upham
2017-05-01 20:48 ` Derek Upham
2017-05-02 19:35 ` Andy Wingo
2017-05-03 3:18 ` Derek Upham
2017-05-03 9:24 ` Andy Wingo
2017-05-03 9:39 ` szgyg
2017-05-03 14:21 ` Derek Upham
2017-05-09 19:08 ` Andy Wingo
2017-05-12 14:13 ` Derek Upham
2017-05-15 20:06 ` Andy Wingo
2017-05-04 5:21 ` zv
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pogft8c2.fsf@priss.frightenedpiglet.com \
--to=sand@blarg.net \
--cc=guile-devel@gnu.org \
--cc=wingo@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).