2009/3/5 Neil Jerram <n...@ossau.uklinux.net>: > Linas Vepstas <linasveps...@gmail.com> 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