From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Linas Vepstas" Newsgroups: gmane.lisp.guile.devel Subject: Re: Does anyone actually use threads with guile? Date: Thu, 13 Nov 2008 16:56:46 -0600 Message-ID: <3ae3aa420811131456m6aaa88efs43a709a5ced981f4__19826.1500140235$1226880891$gmane$org@mail.gmail.com> References: <3ae3aa420811122028w3c069b88q93a8290385188f79@mail.gmail.com> <3ae3aa420811122056x3d2b2f75nc22a66ae1d977902@mail.gmail.com> Reply-To: linasvepstas@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1226880822 6037 80.91.229.12 (17 Nov 2008 00:13:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Nov 2008 00:13:42 +0000 (UTC) Cc: bug-guile@gnu.org, guile-devel@gnu.org To: "Andy Wingo" Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Nov 14 00:01:09 2008 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L0lBU-0000Tz-FM for guile-devel@m.gmane.org; Fri, 14 Nov 2008 00:01:08 +0100 Original-Received: from localhost ([127.0.0.1]:44036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0lAM-0006yV-IJ for guile-devel@m.gmane.org; Thu, 13 Nov 2008 17:59:58 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0l7J-000666-9X for guile-devel@gnu.org; Thu, 13 Nov 2008 17:56:49 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0l7H-00065i-Om for guile-devel@gnu.org; Thu, 13 Nov 2008 17:56:48 -0500 Original-Received: from [199.232.76.173] (port=58900 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0l7H-00065X-8h for guile-devel@gnu.org; Thu, 13 Nov 2008 17:56:47 -0500 Original-Received: from an-out-0708.google.com ([209.85.132.245]:22138) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L0l7G-0000Qb-RS for guile-devel@gnu.org; Thu, 13 Nov 2008 17:56:47 -0500 Original-Received: by an-out-0708.google.com with SMTP id c38so531337ana.21 for ; Thu, 13 Nov 2008 14:56:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=4JAB43iKzCeorEdCYXk7ADjPprGcYkYv6dev4ht7AUY=; b=GTmWyvhw8YtAG+P2bkIURDVLH5sNebwhjpEA3we3G0jcFQUGqu+nV08bJdJazzAGP7 LbH60RCUBvmVqHaVPlG44/Gh1g0fnoXx2rqNA3ns9cdV3k9T4qsDYjfQiyBw54gGq0dc jijfTyCxqOwFRdTqKMXDACtGyZwKjhaHpf8nk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references; b=ZvmHqowpvUf5Ch3eOkIgHE+B+oozGj7VWhJMyy3Guxxg18JOgPhwjNEmahK4LauALV FgHwE86Jm0B7UBBkHJX45Y3EA/n76fB73JXVNulkIwy9a+TUH7JH3QM6d75bzsYoc18G wspCR3qBf8MMf5jQiqXT0AGiKyQ1Tm8OOqy+0= Original-Received: by 10.100.142.4 with SMTP id p4mr190591and.23.1226617006120; Thu, 13 Nov 2008 14:56:46 -0800 (PST) Original-Received: by 10.100.249.18 with HTTP; Thu, 13 Nov 2008 14:56:45 -0800 (PST) In-Reply-To: Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:7854 2008/11/13 Andy Wingo : > For my part I apologize for not having the cycles Fine, I'm hacking around it for now, but would like to see something for 1.8.6. > On Thu 13 Nov 2008 05:56, "Linas Vepstas" writes: > >> Basically, at any given time, some thread might be >> in a critical section. Some other thread may be >> throwing an error for some utterly unrelated reason. >> Yet, when the error is thrown, this "critical section" >> check will trip, and it will do so for an utterly bogus >> reason. At least, that describes my case. >> >> Is there any reason at all not to remove this check >> entirely? (at libguile/throw.c line 695.) > > I think the idea behind the check sounds good -- it is incorrect to > throw from within a critical section, and the check detects this. > > But the check is incorrect as you noticed, it should be checking if the > current thread is in a critical section. The patch below does this. I do not understand how 'async' fits into the grand scheme of things. From what I can tell, though, there won't be any cases where the thrower will be in a different thread than where scm_ithrow() will run. So the patch should be good. --linas --- libguile/throw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: guile-1.8.5/libguile/throw.c =================================================================== --- guile-1.8.5.orig/libguile/throw.c 2008-11-13 16:02:26.000000000 -0600 +++ guile-1.8.5/libguile/throw.c 2008-11-13 16:29:46.000000000 -0600 @@ -689,7 +689,7 @@ scm_ithrow (SCM key, SCM args, int noret SCM dynpair = SCM_UNDEFINED; SCM winds; - if (scm_i_critical_section_level) + if (SCM_I_CURRENT_THREAD->block_asyncs) { fprintf (stderr, "throw from within critical section.\n"); abort ();