unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
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, 12 May 2017 07:13:06 -0700	[thread overview]
Message-ID: <878tm26u4t.fsf@priss.frightenedpiglet.com> (raw)
In-Reply-To: <87shkdrgpz.fsf@pobox.com>


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.
- call-with-new-thread is documented to return a Scheme object from a thunk/handler.  Any underlying pthreads should be implementation details.
- 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.

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?  We can also update stop_finalization_thread to use the new scm_i_pthread_join.

Unfortunately, I think the GC threads are going to end up being immovable objects in the path to full process-form support.

Derek

-- 
Derek Upham
sand@blarg.net



  reply	other threads:[~2017-05-12 14:13 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 [this message]
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=878tm26u4t.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).