summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-01-26 22:47:55 +0800
committerruki <[email protected]>2024-01-26 22:47:55 +0800
commit77d5bd7344d7942a4d5de1ab590f1536fbcb3ed6 (patch)
tree9335c3db76155fb8c81d9c59d3bdd25ee6ca2315
parenta4f12b48cc062cade64b7e5eaaeb1a04e3c80632 (diff)
improve lock
-rw-r--r--xmake/core/base/scheduler.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua
index 262c842dd..12808a162 100644
--- a/xmake/core/base/scheduler.lua
+++ b/xmake/core/base/scheduler.lua
@@ -547,6 +547,9 @@ function scheduler:co_lock(lockname)
if co_locked_tasks[lockname] == nil then
co_locked_tasks[lockname] = running
return true
+ -- has been locked by the current coroutine
+ elseif co_locked_tasks[lockname] == running then
+ return true
end
-- register timeout task to timer