File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -458,6 +458,11 @@ struct lua_Debug {
458
458
459
459
/* }====================================================================== */
460
460
461
+ /* Add by skynet */
462
+
463
+ LUA_API lua_State * skynet_sig_L ;
464
+ LUA_API void (lua_checksig_ )(lua_State * L );
465
+ #define lua_checksig (L ) if (skynet_sig_L) { lua_checksig_(L); }
461
466
462
467
/******************************************************************************
463
468
* Copyright (C) 1994-2015 Lua.org, PUC-Rio.
Original file line number Diff line number Diff line change 63
63
64
64
#endif
65
65
66
-
66
+ /* Add by skynet */
67
+ lua_State * skynet_sig_L = NULL ;
68
+
69
+ LUA_API void
70
+ lua_checksig_ (lua_State * L ) {
71
+ if (skynet_sig_L == G (L )-> mainthread ) {
72
+ skynet_sig_L = NULL ;
73
+ lua_pushnil (L );
74
+ lua_error (L );
75
+ }
76
+ }
67
77
68
78
/*
69
79
** Try to convert a value to a float. The float case is already handled
@@ -1028,6 +1038,7 @@ void luaV_execute (lua_State *L) {
1028
1038
vmbreak ;
1029
1039
}
1030
1040
vmcase (OP_JMP ) {
1041
+ lua_checksig (L );
1031
1042
dojump (ci , i , 0 );
1032
1043
vmbreak ;
1033
1044
}
@@ -1080,6 +1091,7 @@ void luaV_execute (lua_State *L) {
1080
1091
vmcase (OP_CALL ) {
1081
1092
int b = GETARG_B (i );
1082
1093
int nresults = GETARG_C (i ) - 1 ;
1094
+ lua_checksig (L );
1083
1095
if (b != 0 ) L -> top = ra + b ; /* else previous instruction set top */
1084
1096
if (luaD_precall (L , ra , nresults )) { /* C function? */
1085
1097
if (nresults >= 0 ) L -> top = ci -> top ; /* adjust results */
@@ -1094,6 +1106,7 @@ void luaV_execute (lua_State *L) {
1094
1106
}
1095
1107
vmcase (OP_TAILCALL ) {
1096
1108
int b = GETARG_B (i );
1109
+ lua_checksig (L );
1097
1110
if (b != 0 ) L -> top = ra + b ; /* else previous instruction set top */
1098
1111
lua_assert (GETARG_C (i ) - 1 == LUA_MULTRET );
1099
1112
if (luaD_precall (L , ra , LUA_MULTRET )) /* C function? */
@@ -1203,6 +1216,7 @@ void luaV_execute (lua_State *L) {
1203
1216
}
1204
1217
vmcase (OP_TFORLOOP ) {
1205
1218
l_tforloop :
1219
+ lua_checksig (L );
1206
1220
if (!ttisnil (ra + 1 )) { /* continue loop? */
1207
1221
setobjs2s (L , ra , ra + 1 ); /* save control variable */
1208
1222
ci -> u .l .savedpc += GETARG_sBx (i ); /* jump back */
You can’t perform that action at this time.
0 commit comments