From 656b3cea1b6071f30099cef27788a8616a162b7a Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 14 Dec 2015 09:54:49 -0200 Subject: using 'sig_atomic_t' for 'hookmask' (as it can be changed inside a signal) --- lstate.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lstate.h b/lstate.h index b5ac89c2..70cf52ba 100644 --- a/lstate.h +++ b/lstate.h @@ -1,5 +1,5 @@ /* -** $Id: lstate.h,v 2.127 2015/11/02 16:01:41 roberto Exp roberto $ +** $Id: lstate.h,v 2.128 2015/11/13 12:16:51 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -33,6 +33,15 @@ struct lua_longjmp; /* defined in ldo.c */ +/* +** Atomic type (relative to signals) to better ensure that 'lua_sethook' +** is thread safe +*/ +#if !defined(l_signalT) +#include +#define l_signalT sig_atomic_t +#endif + /* extra stack space to handle TM calls and some other extras */ #define EXTRA_STACK 5 @@ -169,7 +178,7 @@ struct lua_State { int hookcount; unsigned short nny; /* number of non-yieldable calls in stack */ unsigned short nCcalls; /* number of nested C calls */ - lu_byte hookmask; + l_signalT hookmask; lu_byte allowhook; }; -- cgit v1.2.3-55-g6feb