guile-user
[Top][All Lists]
Advanced

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

Re: Guile + pthreads + reentrancy?


From: Mikael Djurfeldt
Subject: Re: Guile + pthreads + reentrancy?
Date: Tue, 24 Feb 2004 10:02:56 -0500
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

address@hidden writes:

> I'm trying to get Guile working in a pthreaded program.  I ran up
> against the stack overflow problem, as discussed here:
>
> http://sources.redhat.com/ml/guile/1999-10/msg00114.html
> http://mail.gnu.org/archive/html/guile-user/2001-08/msg00082.html
> http://www.red-bean.com/guile/guile/old/1790.html
>
> I did the message-queueing kludge.  It works, although it is messy.
> But it's not reentrant.  If I tell Guile's pthread to call
> scm_eval_string, which in turn calls a gsubr, and that gsubr spawns a
> new pthread which queues a call to scm_makfrom0str, we have a
> deadlock.
>
> This situtation seems obscure, but it happens in the program I'm
> writing.
>
> The only solution I could come up with is to spawn a new Guile thread
> for each item popped off the queue, so the loop doesn't stop while a
> function is being called.  But Guile threads are cooperative, and I
> can't figure out any way to have scm_yield called at the right time in
> Guile's pthread.
>
> Has anyone else succeeded at doing this?  Am I missing something
> obvious?

The thread support in Guile has undergone two revisions since the
version you are using.  Do you have constraints for which version of
Guile to use?  Current CVS HEAD have full pthreads support, which
should make you able to remove the message queue and access Guile
directly from each thread.

M





reply via email to

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