summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-10-05 23:59:41 +0800
committerruki <[email protected]>2025-10-05 23:59:41 +0800
commit830576d6f9f836af53cc8ea3776c6b3846b0e84f (patch)
treee31d76a6f7736303112bc85714745d9fbfa7c4d7
parentbe7b09dff7df31221ee205e1a8c086e9ee3a5568 (diff)
check post error
-rw-r--r--xmake/core/base/scheduler.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua
index a3dce684b..8327af6e8 100644
--- a/xmake/core/base/scheduler.lua
+++ b/xmake/core/base/scheduler.lua
@@ -63,8 +63,16 @@ function _semaphore:post(value)
local waiting = self._WAITING
local post_count = 0
while not waiting:empty() do
- local item = waiting:pop()
- scheduler:co_resume(item)
+ local cp = waiting:pop()
+ if not cp:is_suspended() then
+ self._POSTING = false
+ return -1, string.format("%s cannot be resumed, status: %s", co, co:status())
+ end
+ local ok, errors = scheduler:co_resume(cp)
+ if not ok then
+ self._POSTING = false
+ return -1, errors
+ end
post_count = post_count + 1
if post_count >= new_value then
break