guile-devel
[Top][All Lists]
Advanced

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

Re: Locks and threads


From: Linas Vepstas
Subject: Re: Locks and threads
Date: Thu, 5 Mar 2009 15:56:52 -0600

2009/3/5 Neil Jerram <address@hidden>:
> Linas Vepstas <address@hidden> writes:
>
>> I don't understand the patch.
>>
>> libguile/scmsigs.c has a SCM_CRITICAL_SECTION_START
>> at line 339, which seems to be balanced by
>> SCM_CRITICAL_SECTION_END;
>> at lines 442 and 461, right before the return from
>> the subroutine.
>>
>> So why insert this seemingly un-needed SCM_CRITICAL_SECTION_END,
>> and worse, nest it in an else block?
>
> Because when scm_sigaction_for_thread decides to throw an out-of-range
> error (by the `SCM_OUT_OF_RANGE' call), it will exit non-locally at
> that point (by calling `longjmp').  So, in this case, it won't pass
> through (either of) the SCM_CRITICAL_SECTION_ENDs just before the
> return statement.
>
> Does that make sense now?

Ah. I suspected as much, and started reading the code,
but clearly I didn't go deep enough. Just now I double
checked and eventually found the longjump in throw.c
after digging fairly deep.

Perhaps I'm naive, perhaps some naming convention
could be used to  indicate that SCM_OUT_OF_RANGE
will never return?  None of the functions in the call stack
gave any real hint that they might now return; they mostly
looked liked ordinary functions.

--linas




reply via email to

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