From: Andy Wingo <wingo@pobox.com>
To: Derek Upham <sand@blarg.net>
Cc: 26858@debbugs.gnu.org, guile-devel@gnu.org
Subject: Re: Cygwin port of Guile 2.2
Date: Mon, 15 May 2017 22:06:27 +0200 [thread overview]
Message-ID: <87ziedopfg.fsf@pobox.com> (raw)
In-Reply-To: <878tm26u4t.fsf@priss.frightenedpiglet.com> (Derek Upham's message of "Fri, 12 May 2017 07:13:06 -0700")
Greets,
On Fri 12 May 2017 16:13, Derek Upham <sand@blarg.net> writes:
> Andy Wingo <wingo@pobox.com> writes:
>
>> scm_join_thread isn't actually implemented in terms of
>> scm_i_pthread_join any more. Probably that's what's going wrong here --
>> and probably that should be fixed to ensure that we actually join the
>> thread. (Otherwise it would be a memory leak too AFAIU.) Bcc'ing
>> bug-guile to create a bug for that.
>
> I noticed that scm_join_thread was calling back into Scheme-land. Are these statements all correct?
>
> - We are using call-with-new-thread underneath the hood.
Underneath the hood of what? :)
> - call-with-new-thread is documented to return a Scheme object from a
> thunk/handler. Any underlying pthreads should be implementation
> details.
Correct. In practice call-with-new-thread will create a pthread but I
can imagine circumstances in which it might (in the future) spawn an
auxiliary pthread for some reason, and I wouldn't want to rule that out.
> - The spawned thread sends the Scheme object to the condition variable
> as soon as the user thunk exits. Any number of operations can happen
> afterwards; the thread is still running in Scheme-land at this point,
> in call-with-new-thread’s wrapping thunk.
> - join-thread waits on the condition variable only.
These are implementation details. They are correct but probably the
implementation should change to do the scm_i_pthread_join and we should
guarantee that after the join, the thread is really dead. This is bug
26858.
> So at the end of join-thread we need to add a call to
> scm_i_pthread_join (which we implement in threads.c) to ensure that
> the pthread is completely gone before that join-thread returns. Is
> that accurate?
Well... yes, but we have to ensure that we call scm_i_pthread_join at
most once. I think calling pthread_join twice on a thread is
undefined. So there are some gnarlies here. Need to fix this.
> Unfortunately, I think the GC threads are going to end up being
> immovable objects in the path to full process-form support.
You can disable marker threads with the GC_MARKERS environment variable,
and the finalization thread should come and go as needed. Probably this
is not a blocker from your POV. Signal handling is probably the most
serious issue; perhaps we can avoid the thread somehow, since we handle
signals asynchronously anyway..
Andy
next prev parent reply other threads:[~2017-05-15 20:06 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
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 [this message]
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=87ziedopfg.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=26858@debbugs.gnu.org \
--cc=guile-devel@gnu.org \
--cc=sand@blarg.net \
/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).