diff options
| author | ruki <[email protected]> | 2025-04-28 21:04:42 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-08-28 11:35:53 +0800 |
| commit | c144ca1a86c559af204f0b51c4cf2b2c5afe0d41 (patch) | |
| tree | 5ee252819508ce01476fbfc3b50a80c32ef74fd3 | |
| parent | 568e22b7879e47616ba96e35a750cf950321742c (diff) | |
improve sleep tests
| -rw-r--r-- | tests/modules/thread/sleep.lua | 3 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/sandbox/module.lua | 6 | ||||
| -rw-r--r-- | xmake/core/thread/thread.lua | 10 |
3 files changed, 6 insertions, 13 deletions
diff --git a/tests/modules/thread/sleep.lua b/tests/modules/thread/sleep.lua index 59c22dc07..294c04fea 100644 --- a/tests/modules/thread/sleep.lua +++ b/tests/modules/thread/sleep.lua @@ -1,8 +1,6 @@ import("core.thread.thread") function callback(id) - print("import", import) - --[[ import("core.thread.thread") print("%s: %d starting ..", thread.running(), id) local dt = os.mclock() @@ -12,7 +10,6 @@ function callback(id) end dt = os.mclock() - dt print("%s: %d end, dt: %d ms", thread.running(), id, dt) - ]] end function main() diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua index 7168cbffe..3a50e862b 100644 --- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua +++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua @@ -619,14 +619,8 @@ end -- @note the polymiorphism is not supported for import.inherit mode now. -- function core_sandbox_module.inherit(name, opt) - - -- init opt opt = opt or {} - - -- mark as inherit opt.inherit = true - - -- import and inherit it return core_sandbox_module.import(name, opt) end diff --git a/xmake/core/thread/thread.lua b/xmake/core/thread/thread.lua index 19546c878..612af4865 100644 --- a/xmake/core/thread/thread.lua +++ b/xmake/core/thread/thread.lua @@ -202,6 +202,7 @@ end -- get the running thread function thread.running() -- TODO + return "<unknown>" end -- run thread @@ -217,7 +218,7 @@ function thread._run_thread(callinfo_str) callback_str = parts[1] end - -- load callback + -- load callback, TODO print thread name local callback local fenvs = {} if callback_str then @@ -225,14 +226,15 @@ function thread._run_thread(callinfo_str) if not script then return false, string.format("cannot load thread callback, %s!", errors or "unknown") end - --[[ for i = 1, math.huge do local upname, upvalue = debug.getupvalue(script, i) if upname == nil or upname == "" then break end - print("upname", i, upname, upvalue) - end]] + if upvalue == nil then + return false, string.format("we cannot access upvalue(%s) in thread callback!", upname) + end + end callback = script end if not callback then |
