summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtest/script/elua_time_out.lua11
-rw-r--r--src/elua_func.cpp2
2 files changed, 9 insertions, 4 deletions
diff --git a/gtest/script/elua_time_out.lua b/gtest/script/elua_time_out.lua
index 112dabc..21af197 100644
--- a/gtest/script/elua_time_out.lua
+++ b/gtest/script/elua_time_out.lua
@@ -1,10 +1,15 @@
local str = TEST.data
local sum = 0
-for i = 0, 10000 do
- for j = 0, 1000 do
- sum = sum + i + j
+
+local function test()
+ for i = 0, 10000 do
+ for j = 0, 10000 do
+ sum = sum + i + j
+ end
end
end
+test()
+
return string.len(str), str
diff --git a/src/elua_func.cpp b/src/elua_func.cpp
index 287efff..4c105d0 100644
--- a/src/elua_func.cpp
+++ b/src/elua_func.cpp
@@ -548,7 +548,7 @@ static int elua_set_script_timeout(struct lua_State *L, int ms)
else
{
elua_info->elua_mode = elua_JIT_OFF;
- luaJIT_setmode(L, 1, LUAJIT_MODE_FUNC | LUAJIT_MODE_OFF);
+ luaJIT_setmode(L, 0, LUAJIT_MODE_ENGINE | LUAJIT_MODE_OFF);
int hook_granularity = ms * 1000000 / 20; // about ms / 20
lua_sethook(L, (lua_Hook)luaMaskCountHook, LUA_MASKCOUNT, hook_granularity);
}