diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-06 14:06:47 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-06 14:06:47 -0300 |
commit | 314c6057b785cd94ac88905ccfce61724107d66b (patch) | |
tree | 6948ee4fec2cacb850307dab1632bfdb4f777459 /ldo.c | |
parent | d39ea8b3ce684728c1ad5005192766d39d2e8baa (diff) | |
download | lua-314c6057b785cd94ac88905ccfce61724107d66b.tar.gz lua-314c6057b785cd94ac88905ccfce61724107d66b.tar.bz2 lua-314c6057b785cd94ac88905ccfce61724107d66b.zip |
Avoid any code before locks in the API
For consistency in the C API, avoid any initializations before
callling lua_lock.
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -705,9 +705,10 @@ LUA_API int lua_isyieldable (lua_State *L) { | |||
705 | 705 | ||
706 | LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, | 706 | LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, |
707 | lua_KFunction k) { | 707 | lua_KFunction k) { |
708 | CallInfo *ci = L->ci; | 708 | CallInfo *ci; |
709 | luai_userstateyield(L, nresults); | 709 | luai_userstateyield(L, nresults); |
710 | lua_lock(L); | 710 | lua_lock(L); |
711 | ci = L->ci; | ||
711 | api_checknelems(L, nresults); | 712 | api_checknelems(L, nresults); |
712 | if (unlikely(!yieldable(L))) { | 713 | if (unlikely(!yieldable(L))) { |
713 | if (L != G(L)->mainthread) | 714 | if (L != G(L)->mainthread) |