This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Sascha Ziemann <szi@aibon.ping.de> writes > > Hi, > > when I protect a chunk with a mutex I have to catch all exeptions in > order to unlock the mutex in a case of an exeptions. After this I have > the throw the same exeption again. But then the source of the exeption > is my exeption handler and not the place, where the exeption has been > originally thrown. Is it possible to bypass the orginal thrown > exeption in such a case? > As far as I understand the way exceptions work in Guile, this problem can be solved by using dynamic-wind: (dynamc-wind (lambda () ; before ... lock the mutexes ...) (lambda () ; thunk ... do all this dangerous stuff ...) (lambda () ; after ... unlock mutexes ...)) the after part is always called, even when thunk has a non-local exit (as in an exception). See R5RS for a detailed description of dynamic-wind. David