lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Oct 11, 2006 at 10:32:45AM -0300, Roberto Ierusalimschy wrote:
> lua_sethook has no intention of being "thread safe".  As already pointed
> out in this discussion, multithreading is a can of worms that opens
> the door to hell. It is quite difficult to write correct code with
> multithreading, and it is mostly impossible to argue that the code is
> correct (although, of course, it can be easy to argue that it is wrong).
> 
> However, lua_sethook has a clear intention of being "signal safe". If
> it is not, we would like to correct it.

It says "can be called asynchronous".  That sounds like "can be called
from a thread", and that Mike's interpretation, too.  If you only mean
"from a signal", maybe that comment could be clarified.

It also seems like there should be two lua_sethooks; one for signals,
which doesn't lock, and one for threads, which does lua_lock, like other
API calls.  Otherwise, this is one of the few (that I've seen) functions
which is not threadsafe when locking is enabled.

-- 
Glenn Maynard