summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-03-07 00:03:06 +0800
committerruki <[email protected]>2024-03-07 00:03:06 +0800
commit1f4cc42199c464ba06fa91b5beac0be14d72312f (patch)
tree7dcbcd605eec5c35ba3599d6ced6191ec5d6fb85
parent76c06082da0c75967c5c19841ba8a06beefc5e45 (diff)
improve scheduler
-rw-r--r--xmake/core/base/scheduler.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua
index 12808a162..6944afec0 100644
--- a/xmake/core/base/scheduler.lua
+++ b/xmake/core/base/scheduler.lua
@@ -179,8 +179,10 @@ function scheduler:_poller_resume_co(co, events)
events = poller.EV_POLLER_ERROR
end
- -- this coroutine must be suspended
- assert(co:is_suspended())
+ -- this coroutine must be suspended, (maybe also dead)
+ if not co:is_suspended() then
+ return false, string.format("%s cannot be resumed, status: %s", co, co:status())
+ end
-- resume this coroutine task
co:waitobj_set(nil)