[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: How to disable hooks?
- From: Thijs Schreijer <thijs@...>
- Date: Wed, 10 Jun 2015 11:30:53 +0000
> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Richter, Jörg
> Sent: woensdag 10 juni 2015 8:48
> To: lua-l@lists.lua.org
> Subject: How to disable hooks?
>
> Hi,
>
> I’ve noticed that there seems to be no way to disable all hooks. Once a hook
> is
> installed, calling lua_sethook( L, 0, 0, 0 ) will not prevent all calls to
> the hook
> function if in between a new thread was created. If this new thread executes
> again then the hook will be called. This is because a new thread inherits
> the
> hook settings of the creating thread. Lacking an interface to enumerate all
> threads, it seems impossible to disable a hook completely. Is this correct?
>
> It seems that using only one hook setting for all threads is more desirable.
> Does anybody use the feature to install different hooks on two threads?
>
> I have an ideas for a workaround by using another indirection. But are there
> any other possible solutions?
>
> This is with Lua 5.2.4.
>
> - Jörg
>
>
With my corowatch module, I provided functions to monkeypatch the coroutine creation. The patched versions track the coroutines created.
Won't win a beauty contest, but works.
Thijs