[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: hook question
- From: roberto@... (Roberto Ierusalimschy)
- Date: Mon, 16 Oct 2006 11:19:25 -0200
> lua_sethook() is advertised as being signal-safe. I'm prepared to trust
> Roberto's judgement that it is, although it seems to me that Posix
> would prefer that some of those fields be declared as volatile
> sig_atomic_t. However, I'm sure that Roberto has thought this through,
> and certainly I haven't noticed any problems with it.
Thanks for the compliment. However, as I said before, it is mostly
impossible to really "think through" a piece of multithreading code.
Rethinking about the subject, I am afraid lua_sethook is not
"theoretically" safe even for signals (as it should be).
The problem is the non-atomicity of pointer accesses. There is a small
risk that, while luaD_callhook is reading L->hook, lua_sethook changes
it, so that luaD_callhook reads an invalid pointer.
I cannot see any simple way to correct this, without imposing some
restrictions on lua_sethook.
-- Roberto
- References:
- Re: hook question, Rici Lake
- Re: hook question, Rici Lake
- Re: hook question, Glenn Maynard
- Re: hook question, Roberto Ierusalimschy
- Re: hook question, Glenn Maynard
- Re: hook question, Rici Lake
- Re: hook question, Glenn Maynard
- Re: hook question, Rici Lake
- Re: hook question, Glenn Maynard
- Re: hook question, Rici Lake