unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
To: ludo@gnu.org (Ludovic Courtès)
Cc: Ken Raeburn <raeburn@raeburn.org>, guile-devel@gnu.org
Subject: (no subject)
Date: Thu, 01 Oct 2009 22:05:16 +0100	[thread overview]
Message-ID: <871vlm3jw3.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <87ocorni7v.fsf@gnu.org> ("Ludovic Courtès"'s message of "Thu, 01 Oct 2009 19:21:08 +0200")

ludo@gnu.org (Ludovic Courtès) 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 ‘master’.  (BTW ‘signals.test’
> should be changed to GPLv3+ and have a ‘define-module’ clause.)

Thanks, done.

>> commit 3009b5d557e1ebfd828fd0de9b1da5abb2f6ec9a
>> Author: Neil Jerram <neil@ossau.uklinux.net>
>> 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 () 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 section.\n");
>        abort ();
>
> Critical sections concern all the threads in guile mode.  Thus I would
> think that the question “are the threads in a critical section?” cannot
> be answered by looking at a per-thread ‘critical_section_level’.

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 ‘throw’s
> when the *current thread* is holding the critical section mutex, so the
> patch is correct but I find the name ‘critical_section_level’ 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’t get any Helgrind report!
> :-)

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




  reply	other threads:[~2009-10-01 21:05 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-10 19:41 i guess we're frozen & stuff Andy Wingo
2009-08-10 21:08 ` Mike Gran
2009-08-10 21:16   ` Andy Wingo
2009-08-10 21:37   ` Ludovic Courtès
2009-08-11 11:34 ` Greg Troxel
2009-08-11 13:59   ` Ken Raeburn
2009-08-11 14:45     ` Ken Raeburn
2009-08-11 15:36       ` Ludovic Courtès
2009-08-11 15:50         ` Ken Raeburn
2009-08-12 22:42       ` Andy Wingo
2009-08-11 15:34     ` Ludovic Courtès
2009-08-12 22:41     ` Andy Wingo
2009-09-16 19:00       ` Andy Wingo
2009-09-25 21:59         ` Ken Raeburn
2009-09-26 15:45           ` Mike Gran
2009-09-26 22:36             ` Ken Raeburn
2009-09-26 23:11               ` Mike Gran
2009-09-26 21:02           ` Ludovic Courtès
2009-09-26 22:26             ` Ken Raeburn
2009-09-27  9:10               ` Ludovic Courtès
2009-09-27 10:01                 ` Ken Raeburn
2009-09-28  7:39                   ` Ludovic Courtès
2009-09-28 17:22             ` Neil Jerram
2009-09-28 18:48               ` Ludovic Courtès
2009-09-28 22:42                 ` Neil Jerram
2009-09-28 23:21                   ` Bug #27457 (“Threads, mutexes, and critical sections”) Ludovic Courtès
2009-09-30 20:59                     ` (no subject) Neil Jerram
2009-10-01 17:21                       ` Bug #27457 (“Threads, mutexes, and critical sections”) Ludovic Courtès
2009-10-01 21:05                         ` Neil Jerram [this message]
2009-10-01 19:45                       ` Ken Raeburn
2009-10-01 20:44                         ` (no subject) Neil Jerram
2009-09-28 23:27                   ` i guess we're frozen & stuff Ken Raeburn
2009-09-28 23:08           ` Ken Raeburn
2009-08-26 22:18     ` Neil Jerram
2009-08-11 12:29 ` Greg Troxel
2009-08-11 15:48   ` Mike Gran
2009-08-11 15:54   ` Ludovic Courtès
2009-08-11 16:13     ` Mike Gran
2009-08-11 17:01       ` Ludovic Courtès
2009-08-11 17:49         ` Mike Gran
2009-08-11 17:04     ` Greg Troxel
2009-08-11 18:14       ` Ken Raeburn
2009-08-11 20:34         ` Ludovic Courtès
2009-08-11 21:58           ` Greg Troxel
2009-08-11 22:46             ` Ludovic Courtès
2009-08-12 13:08               ` Greg Troxel
2009-08-12 14:38                 ` Ludovic Courtès
2009-08-12 16:36                   ` Greg Troxel
2009-08-11 18:15       ` Ludovic Courtès
2009-08-11 18:17         ` Greg Troxel
2009-08-11 20:26           ` Ludovic Courtès
2009-08-11 22:07             ` Greg Troxel
2009-08-11 17:24     ` Greg Troxel
2009-08-11 19:10       ` i18n issues on NetBSD Ludovic Courtès
2009-08-11 22:05         ` Greg Troxel
2009-08-11 22:58           ` Ludovic Courtès
2009-08-11 17:46   ` i guess we're frozen & stuff Juhani Viheräkoski
2009-08-11 18:01     ` Mike Gran
2009-08-11 20:31       ` Ludovic Courtès
2009-08-11 13:27 ` Greg Troxel
2009-08-11 13:39 ` unsigned char confusion Greg Troxel
2009-08-11 15:23   ` Mike Gran
2009-08-11 17:05 ` i guess we're frozen & stuff Ken Raeburn
2009-08-11 20:27   ` Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2009-10-02  9:15 Merging ‘bdw-gc-static-alloc’ Ludovic Courtès
2009-10-02 16:26 ` Andy Wingo
2009-10-23  9:16   ` Ludovic Courtès
2009-10-23 12:57     ` Andy Wingo
2009-11-02 21:44       ` Ludovic Courtès
2009-11-03 20:57         ` (no subject) Neil Jerram
2009-11-05 22:30           ` Merging ‘bdw-gc-static-alloc’ Ludovic Courtès
2009-11-08 22:21             ` (no subject) Neil Jerram
2004-10-14 19:23 Tanisha Villalobos
2004-10-03 22:32 Karen Ferguson
2002-11-09  8:29 Dirk Herrmann
2002-11-09 20:42 ` Clinton Ebadi
2002-08-04 16:33 Han-Wen
2002-08-04 18:38 ` Rob Browning
2002-03-30 16:59 ±è°æÀÏ

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871vlm3jw3.fsf@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    --cc=raeburn@raeburn.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).