From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mikael Djurfeldt Newsgroups: gmane.lisp.guile.user Subject: Re: Guile + pthreads + reentrancy? Date: Tue, 24 Feb 2004 10:02:56 -0500 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: References: <16442.35630.790674.12804@gargle.gargle.HOWL> Reply-To: djurfeldt@nada.kth.se NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077635095 24006 80.91.224.253 (24 Feb 2004 15:04:55 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2004 15:04:55 +0000 (UTC) Cc: guile-user@gnu.org, djurfeldt@nada.kth.se Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Feb 24 16:04:47 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ave75-0008Tf-00 for ; Tue, 24 Feb 2004 16:04:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Ave6g-0007x4-Lf for guile-user@m.gmane.org; Tue, 24 Feb 2004 10:04:22 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1Ave61-0007va-2v for guile-user@gnu.org; Tue, 24 Feb 2004 10:03:41 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1Ave5T-0007hX-Jf for guile-user@gnu.org; Tue, 24 Feb 2004 10:03:38 -0500 Original-Received: from [213.212.20.77] (helo=kvast.blakulla.net) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Ave5T-0007hF-5h for guile-user@gnu.org; Tue, 24 Feb 2004 10:03:07 -0500 Original-Received: from chunk.mit.edu ([18.42.2.92] helo=chunk ident=Debian-exim) by kvast.blakulla.net with esmtp (Exim 3.36 #1 (Debian)) id 1Ave5N-0007u0-00; Tue, 24 Feb 2004 16:03:02 +0100 Original-Received: from mdj by chunk with local (Exim 4.30) id 1Ave5I-0007J3-38; Tue, 24 Feb 2004 10:02:56 -0500 Original-To: bindej@rpi.edu In-Reply-To: <16442.35630.790674.12804@gargle.gargle.HOWL> (bindej@rpi.edu's message of "Mon, 23 Feb 2004 18:22:22 -0500") User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:2837 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:2837 bindej@rpi.edu 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 _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user