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: Derek Upham
Subject: Re: Cygwin port of Guile 2.2
Date: Fri, 12 May 2017 07:13:06 -0700
User-agent: mu4e 0.9.17; emacs 25.1.1

Andy Wingo <address@hidden> 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
address@hidden



reply via email to

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