[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Exceptions and locks
- From: Mark Hamburg <mhamburg@...>
- Date: Fri, 19 Sep 2003 22:47:32 -0700
I had overriden luaD_throw and luaD_rawrunprotected so that they used
something other than Lua's setjmp/longjmp mechanism. (Specifically, I was
using MacOS X Cocoa exceptions, but C++ exceptions would also have worked.)
I just ran into a problem, however, with some code calling lua_error
blocking on the mutex. So, here is my question:
Would it be correct and safe to unlock the mutex at the beginning of my
throw implementation and to relock it if I catch an exception? I believe
this matches the mutex state on entry and exit from the original
luaD_rawrunprotected and luaD_throw routines, so my chief concern is whether
there could be any problems with having the mutext unlocked during the throw
when it wasn't unlocked before.
Thanks.
Mark