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]

Re: mutex and exeptions


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?

Instead of `lock-mutex'/`unlock-mutex' pair, you can use the
`with-mutex' macro - it puts the stuff under it in a `dynamic-wind'
and takes care of locking and unlocking in the wind guards, so your
problem disappears.

HTH,
mike.