diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-12-16 14:40:07 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-12-16 14:40:07 -0200 |
| commit | a051b3323ef6d12677e78ec0a47d1731bd424d38 (patch) | |
| tree | 373d529a4df8d94f81f811dcef19627b5e30e2e5 | |
| parent | c4e01c568aa498fbf141c13589c3cefdd7d9457e (diff) | |
| download | lua-a051b3323ef6d12677e78ec0a47d1731bd424d38.tar.gz lua-a051b3323ef6d12677e78ec0a47d1731bd424d38.tar.bz2 lua-a051b3323ef6d12677e78ec0a47d1731bd424d38.zip | |
comments (about hooks vs signals)
| -rw-r--r-- | ldebug.c | 10 | ||||
| -rw-r--r-- | ldo.c | 9 |
2 files changed, 15 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 2.116 2015/10/22 14:40:47 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 2.117 2015/11/02 18:48:07 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -69,7 +69,13 @@ static void swapextra (lua_State *L) { | |||
| 69 | 69 | ||
| 70 | 70 | ||
| 71 | /* | 71 | /* |
| 72 | ** this function can be called asynchronous (e.g. during a signal) | 72 | ** This function can be called asynchronous (e.g. during a signal). |
| 73 | ** Fields 'oldpc', 'basehookcount', and 'hookcount' (set by | ||
| 74 | ** 'resethookcount') are for debug only, and it is no problem if they | ||
| 75 | ** get arbitrary values (causes at most one wrong hook call). 'hookmask' | ||
| 76 | ** is an atomic value. We assume that pointers are atomic too (e.g., gcc | ||
| 77 | ** ensures that for all platforms where it runs). Moreover, 'hook' is | ||
| 78 | ** always checked before being called (see 'luaD_hook'). | ||
| 73 | */ | 79 | */ |
| 74 | LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { | 80 | LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { |
| 75 | if (func == NULL || mask == 0) { /* turn off hooks? */ | 81 | if (func == NULL || mask == 0) { /* turn off hooks? */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldo.c,v 2.149 2015/11/13 13:24:26 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.150 2015/11/19 19:16:22 roberto Exp roberto $ |
| 3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -242,9 +242,14 @@ void luaD_inctop (lua_State *L) { | |||
| 242 | /* }================================================================== */ | 242 | /* }================================================================== */ |
| 243 | 243 | ||
| 244 | 244 | ||
| 245 | /* | ||
| 246 | ** Call a hook for the given event. Make sure there is a hook to be | ||
| 247 | ** called. (Both 'L->hook' and 'L->hookmask', which triggers this | ||
| 248 | ** function, can be changed asynchronously by signals.) | ||
| 249 | */ | ||
| 245 | void luaD_hook (lua_State *L, int event, int line) { | 250 | void luaD_hook (lua_State *L, int event, int line) { |
| 246 | lua_Hook hook = L->hook; | 251 | lua_Hook hook = L->hook; |
| 247 | if (hook && L->allowhook) { | 252 | if (hook && L->allowhook) { /* make sure there is a hook */ |
| 248 | CallInfo *ci = L->ci; | 253 | CallInfo *ci = L->ci; |
| 249 | ptrdiff_t top = savestack(L, L->top); | 254 | ptrdiff_t top = savestack(L, L->top); |
| 250 | ptrdiff_t ci_top = savestack(L, ci->top); | 255 | ptrdiff_t ci_top = savestack(L, ci->top); |
