guile-user
[Top][All Lists]
Advanced

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

Guile + pthreads + reentrancy?


From: bindej
Subject: Guile + pthreads + reentrancy?
Date: Mon, 23 Feb 2004 18:22:22 -0500

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?

Jeff Binder





reply via email to

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