[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Locking bug in lua_error()?
- From: Colin <share-lua@...>
- Date: Sun, 21 Oct 2007 17:06:58 +0200
On Sun, Oct 21, 2007 at 04:55:15PM +0200, Colin wrote:
> Hi,
>
> digging around in the Lua 5.1.2 source code I noticed that
> lua_error() contains a call to lua_unlock() _after_ the
> call to luaG_errormsg(), although luaG_errormsg() will never
> return (and in fact the comment at the end of lua_error()
> about the "return 0;" only to suppress warnings [because
> luaG_errormsg(), and therefore lua_error(), never return]),
> and the lua_unlock() never called...?
Ok, I think I've found the matching unlock in luaD_throw(),
so the only thing that is amiss is that the lua_unlock() in
lua_error() is superfluous.
Sorry for the noise.
Colin
PS: Gee, how much easier is this with C++ where an automatic
mutex_lock object that locks in the constructor, and
unlocks in the destructor, automatically (sic) cleans
up in case of all errors (= exceptions)...