2
0
Эх сурвалжийг харах

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

Roberto Ierusalimschy 9 жил өмнө
parent
commit
656b3cea1b
1 өөрчлөгдсөн 11 нэмэгдсэн , 2 устгасан
  1. 11 2
      lstate.h

+ 11 - 2
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;
 };