guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cygwin port of Guile 2.2


From: szgyg
Subject: Re: Cygwin port of Guile 2.2
Date: Wed, 3 May 2017 11:39:28 +0200
User-agent: Mutt/1.6.0 (2016-04-01)

On Wed, May 03, 2017 at 11:24:30AM +0200, Andy Wingo wrote:
> On Wed 03 May 2017 05:18, Derek Upham <address@hidden> writes:
> 
> > Andy Wingo <address@hidden> writes:
> >
> >> On Mon 01 May 2017 22:48, Derek Upham <address@hidden> 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
> 

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09
2.9.5 Thread Cancellation
Thread Cancellation Cleanup Handlers

#v+
After all cancellation cleanup handlers and thread-specific data
destructors have returned, thread execution is terminated.
#v-

szgyg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]