lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 656b3cea1b6071f30099cef27788a8616a162b7a
parent 2d1d57bc18c18b06f4f81b9a8ec9e5cd8f915450
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Mon, 14 Dec 2015 09:54:23 -0200

using 'sig_atomic_t' for 'hookmask' (as it can be changed inside
a signal)

Diffstat:
Mlstate.h | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git 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 <signal.h> +#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; };