lua-users home
lua-l archive

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


> There is a third case: threads.

As far as I know _pure Lua_ does not have threads. But anyway...


> Does this apply to the case when lua_sethook() is called asynchronously,
> after the loop execution begins?

Yes, for a reasonable definition of "asynchronously". But note that,
if you are using the standard GIL in Lua code (which is the only
reasonable definition of "asynchronously" I can think of), a tight loop
can never release the lock, and so the other thread will never run.
When/if the thread runs and sets a hook, it will be called.

The only issue is with real signals, which can set a hook at fully
arbitrary points inside the interpreter. If the hook is set at
some very specific points during the manipulation of CallInfos,
maybe Lua can lose it. ("maybe can" means we do not guarantee it
will not happen. It doesn't imply it can happen.)

-- Roberto