guile-user
[Top][All Lists]
Advanced

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

Re: Guile + pthreads + reentrancy?


From: bindej
Subject: Re: Guile + pthreads + reentrancy?
Date: Wed, 3 Mar 2004 12:35:31 -0500

Mikael Djurfeldt writes:
 > address@hidden writes:
 > 
 > > Mikael Djurfeldt writes:
 > >  > Each thread which has been spawned by scm_spawn_thread, that is.
 > >  > 
 > >  > scm_spawn_thread calls pthread_create and sets up Guile things.  If,
 > >  > for some reason, you need to create the pthread yourself and want to
 > >  > later make it able to use Guile, that could be arranged.  Please tell
 > >  > me and I'll add this to the API (this is on the TODO list).
 > >  > 
 > >  > M
 > >
 > > I'm now converting my code to use scm_spawn_thread instead of
 > > pthread_create.  This is not a problem, but there doesn't seem to be
 > > any public interface to get a scm_t_thread out of the SCM object.
 > 
 > You're right that there isn't currently any public interface for
 > getting the scm_t_thread value out of the SCM object.
 > 
 > > This is a serious problem because even functions such as
 > > scm_thread_join take scm_t_thread arguments, and are thus unusable
 > > outside of Guile.
 > >
 > > What should I do about this?
 > 
 > Would it be difficult to use scm_thread_self ()?

Somewhat.  The value is supposed to be available to the parent thread
immediately, so to be safe I would need to use a condition variable
and a global variable to communicate.

 > We should probably add a selector for this, though.  I'll try to add
 > it to CVS HEAD today.  (Do you need it in 1.6?)

My program requires 1.7 anyway, so no.





reply via email to

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