summaryrefslogtreecommitdiff
path: root/xmake/core/base
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-05 23:09:45 +0800
committerruki <[email protected]>2020-02-07 22:45:56 +0800
commita1e36f03bcae56c52c36ca1692725330cd173043 (patch)
treebf1085d08ff5fe430f41c41d7f26502d1a6ec448 /xmake/core/base
parent97d20dc309b8064ab7bafc69a6784caa4df9b107 (diff)
add scheduler:co_group_waitobjs
Diffstat (limited to 'xmake/core/base')
-rw-r--r--xmake/core/base/scheduler.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/xmake/core/base/scheduler.lua b/xmake/core/base/scheduler.lua
index 5e68be8c2..63829a913 100644
--- a/xmake/core/base/scheduler.lua
+++ b/xmake/core/base/scheduler.lua
@@ -453,6 +453,20 @@ function scheduler:co_group_wait(name)
return true
end
+-- get waiting objects for the given group name
+function scheduler:co_group_waitobjs(name)
+ local objs = hashset.new()
+ for _, co in ipairs(self:co_group(name)) do
+ if not co:is_dead() then
+ local obj = co:waitobj()
+ if obj then
+ objs:insert(obj)
+ end
+ end
+ end
+ return objs
+end
+
-- get the current running coroutine
function scheduler:co_running()
local running = coroutine.running()