unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Derek Upham <sand@blarg.net>
Cc: guile-devel@gnu.org
Subject: Re: Cygwin port of Guile 2.2
Date: Wed, 03 May 2017 11:24:30 +0200	[thread overview]
Message-ID: <87lgqes375.fsf@pobox.com> (raw)
In-Reply-To: <87r306d3vx.fsf@priss.frightenedpiglet.com> (Derek Upham's message of "Tue, 02 May 2017 20:18:42 -0700")

On Wed 03 May 2017 05:18, Derek Upham <sand@blarg.net> writes:

> Andy Wingo <wingo@pobox.com> writes:
>
>> On Mon 01 May 2017 22:48, Derek Upham <sand@blarg.net> writes:
>>
>>> Running pthread_join() on a thread only guarantees that the thread has
>>> returned an exit value.
>>
>> Would you mind providing a reference please?  It is not that I don't
>> believe you but I think it's important to know whether this is a bug in
>> Guile or in the pthreads implementation.
>
> It’s not explicit, but it’s heavily implied by the pthread_exit(3) man
> page:

A specific implementation's man page is interesting but not the
specification.  The specification is "The Open Group Base Specifications
Issue 7 IEEE Std 1003.1-2008, 2016 Edition" and can be found here:

  http://pubs.opengroup.org/onlinepubs/9699919799/

Note that pthread_exit() is not the normal way for a Guile thread to
exit.  I thought we removed uses of this but I see that there are a
couple more that need to be removed.  Are you using it?  It's certainly
not one that we suggest.  We don't use pthread_cleanup_push either --
the lifetime of the thread from Guile's POV isn't limited to a dynamic
extent of scm_with_guile, as the thread could be created by the user, as

  https://lists.gnu.org/archive/html/guile-devel/2011-04/msg00133.html

Anyway, I digress.  After looking at the specification of pthread_join
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_join.html),
things do not seem clear to me.  Does the thread "terminate" before or
after the pthread_key destructors run?  Given that:

  * pthread_key destructors must run in the thread AFAIU; to be able to
    call pthread_setspecific in a destructor you need a fresh
    or from a fresh new thread, and spawning a new thread to run cleanup
    seems unlikely

  * pthread_key destructors can call any function

I think there's an argument that a thread doesn't "terminate" until its
thread-local key destructors have finished running, and therefore
pthread_join doesn't return until after the key destructors have run.
This is my understanding of what happens from reading NPTL.  Do I
understand correctly that you are on Cygwin?  Could it be a cygwin
pthreads incompatibility?

Andy



  reply	other threads:[~2017-05-03  9:24 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 [this message]
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=87lgqes375.fsf@pobox.com \
    --to=wingo@pobox.com \
    --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).