From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: (no subject) Date: Thu, 01 Oct 2009 22:05:16 +0100 Message-ID: <871vlm3jw3.fsf@ossau.uklinux.net> References: <0489FB6F-567B-4967-9703-1A3D89462A37@raeburn.org> <79F7A852-10ED-46DF-9D41-ED545493E8FE@raeburn.org> <87pr9dpgfw.fsf@gnu.org> <871vlr6l2p.fsf@ossau.uklinux.net> <87k4zi6h3q.fsf@gnu.org> <87eipqn12l.fsf@ossau.uklinux.net> <87eipqzmdr.fsf_-_@gnu.org> <87tyykw3lm.fsf@ossau.uklinux.net> <87ocorni7v.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1261399825 27919 80.91.229.12 (21 Dec 2009 12:50:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Dec 2009 12:50:25 +0000 (UTC) Cc: Ken Raeburn , guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Dec 21 13:50:18 2009 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 1NMhhK-0000HW-JM for guile-devel@m.gmane.org; Mon, 21 Dec 2009 13:49:14 +0100 Original-Received: from localhost ([127.0.0.1]:44276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NMhhK-0005Ps-F0 for guile-devel@m.gmane.org; Mon, 21 Dec 2009 07:49:14 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MtSr1-0005KZ-Oy for guile-devel@gnu.org; Thu, 01 Oct 2009 17:06:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MtSqw-0005J9-0C for guile-devel@gnu.org; Thu, 01 Oct 2009 17:06:22 -0400 Original-Received: from [199.232.76.173] (port=40100 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtSqv-0005Iy-NG for guile-devel@gnu.org; Thu, 01 Oct 2009 17:06:17 -0400 Original-Received: from mail3.uklinux.net ([80.84.72.33]:41168) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MtSqt-00085e-B4; Thu, 01 Oct 2009 17:06:15 -0400 Original-Received: from arudy (host86-145-159-48.range86-145.btcentralplus.com [86.145.159.48]) by mail3.uklinux.net (Postfix) with ESMTP id BD6E11F667A; Thu, 1 Oct 2009 22:05:36 +0100 (BST) Original-Received: from arudy (arudy [127.0.0.1]) by arudy (Postfix) with ESMTP id F068038023; Thu, 1 Oct 2009 22:05:16 +0100 (BST) In-Reply-To: <87ocorni7v.fsf@gnu.org> ("Ludovic =?iso-8859-1?Q?Court=E8s?= =?iso-8859-1?Q?=22's?= message of "Thu, 01 Oct 2009 19:21:08 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 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:9779 Archived-At: ludo@gnu.org (Ludovic Court=C3=A8s) writes: >>> This is normally somewhat fixed in current BDW-GC CVS, but Guile itself >>> may have troubles of its own dealing with cancellation. >> >> Thanks. I thought already about cancellation, but I couldn't see >> anything in the test program that would do that. Do you know of >> anything in that program, or in BDW-GC, that does a pthread_cancel? > > Hmm no, sorry for the confusion. The srfi-18 test this was taken from > did use cancellation, though. OK, thanks for clarifying that. I guess there must be something other than cancellation lurking. > Good that you noticed it was missing from =E2=80=98master=E2=80=99. (BTW= =E2=80=98signals.test=E2=80=99 > should be changed to GPLv3+ and have a =E2=80=98define-module=E2=80=99 cl= ause.) Thanks, done. >> commit 3009b5d557e1ebfd828fd0de9b1da5abb2f6ec9a >> Author: Neil Jerram >> Date: Tue Mar 10 23:55:31 2009 +0000 >> >> Fix spurious `throw from within critical section' errors >> >> (This is the commit that I hope will fix the errors that you're seeing.) >> >> Can you see how the test runs now? > > The abort=C2=A0() is apparently never reached with this patch. > > It took me some time to understand this: > > - if (scm_i_critical_section_level) > + if (thread->critical_section_level) > { > fprintf (stderr, "continuation invoked from within critical sectio= n.\n"); > abort (); > > Critical sections concern all the threads in guile mode. Thus I would > think that the question =E2=80=9Care the threads in a critical section?= =E2=80=9D cannot > be answered by looking at a per-thread =E2=80=98critical_section_level=E2= =80=99. That's not the question here. The question is "is _this_ thread in a critical section?" There's no reason (AFAIK) why thread A shouldn't throw while thread B is in a critical section. Note that access to the critical section is controlled by a mutex, not by (scm_i_)critical_section_level. (scm_i_)critical_section_level only exists to catch genuine "throw from critical section" errors. > However, it really seems that the intent was really to forbid =E2=80=98th= row=E2=80=99s > when the *current thread* is holding the critical section mutex, so the > patch is correct but I find the name =E2=80=98critical_section_level=E2= =80=99 is > slightly misleading. The tricky detail here is that scm_i_critical_section_mutex is initialized as a recursive mutex, so the implication is that it's possible for a thread to enter the critical section multiple times. Hence we need some kind of "level", instead of just a boolean "in_critical_section". > What do you think? I have no objection to a more intuitive name, if you can suggest one. >> Is that right? > > Yes. Thanks. > BTW, rest assured: thanks to libgc we won=E2=80=99t get any Helgrind repo= rt! > :-) I assume you mean because most of the helgrind reports involved the heap_mutex, which no longer exists. Presumably we could still (in theory) get helgrind reports for other mutexes? Regards, Neil