aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-12-14 09:54:49 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-12-14 09:54:49 -0200
commit656b3cea1b6071f30099cef27788a8616a162b7a (patch)
tree774332608bfa0a25a033088362be71d2b257c0fe
parent2d1d57bc18c18b06f4f81b9a8ec9e5cd8f915450 (diff)
downloadlua-656b3cea1b6071f30099cef27788a8616a162b7a.tar.gz
lua-656b3cea1b6071f30099cef27788a8616a162b7a.tar.bz2
lua-656b3cea1b6071f30099cef27788a8616a162b7a.zip
using 'sig_atomic_t' for 'hookmask' (as it can be changed inside
a signal)
-rw-r--r--lstate.h13
1 files 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 @@
1/* 1/*
2** $Id: lstate.h,v 2.127 2015/11/02 16:01:41 roberto Exp roberto $ 2** $Id: lstate.h,v 2.128 2015/11/13 12:16:51 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -33,6 +33,15 @@
33struct lua_longjmp; /* defined in ldo.c */ 33struct lua_longjmp; /* defined in ldo.c */
34 34
35 35
36/*
37** Atomic type (relative to signals) to better ensure that 'lua_sethook'
38** is thread safe
39*/
40#if !defined(l_signalT)
41#include <signal.h>
42#define l_signalT sig_atomic_t
43#endif
44
36 45
37/* extra stack space to handle TM calls and some other extras */ 46/* extra stack space to handle TM calls and some other extras */
38#define EXTRA_STACK 5 47#define EXTRA_STACK 5
@@ -169,7 +178,7 @@ struct lua_State {
169 int hookcount; 178 int hookcount;
170 unsigned short nny; /* number of non-yieldable calls in stack */ 179 unsigned short nny; /* number of non-yieldable calls in stack */
171 unsigned short nCcalls; /* number of nested C calls */ 180 unsigned short nCcalls; /* number of nested C calls */
172 lu_byte hookmask; 181 l_signalT hookmask;
173 lu_byte allowhook; 182 lu_byte allowhook;
174}; 183};
175 184