Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Jan 29, 2024
1 parent eb9f4ea commit 0135dd9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions xmake/core/base/scheduler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ function scheduler:_co_groups_resume()
break
end
end
print("_co_groups_resume", name, #co_group, count, limit, co_waiting)

-- resume the waiting coroutine of this group if some coroutines are dead in this group
if count >= limit and co_waiting and co_waiting:is_suspended() then
Expand Down Expand Up @@ -669,6 +670,7 @@ function scheduler:co_group_wait(name, opt)
repeat
count = 0
for _, co in ipairs(co_group) do
print(" co: ", co)
if count < limit then
if co:is_dead() then
count = count + 1
Expand All @@ -677,13 +679,15 @@ function scheduler:co_group_wait(name, opt)
break
end
end
print("co_group_wait", count, limit, #co_group)
if count < limit then
self._CO_GROUPS_WAITING = self._CO_GROUPS_WAITING or {}
self._CO_GROUPS_WAITING[name] = {running, limit}
self:co_suspend()
end
until count >= limit

print("co_group_wait end")
-- remove all dead coroutines in group
if limit == #co_group and count == limit then
self._CO_GROUPS[name] = nil
Expand Down
2 changes: 2 additions & 0 deletions xmake/modules/async/runjobs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ function main(name, jobs, opt)
try
{
function()
print("starting", scheduler.co_running())
if stop then
return
end
Expand All @@ -242,6 +243,7 @@ function main(name, jobs, opt)
count = count + 1
end
running_jobs_indices[i] = nil
print("finished", scheduler.co_running())
end,
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,14 +480,18 @@ function _install_packages(packages_install, packages_download, installdeps)
assert(instance:is_precompiled(), "package(%s) should be precompiled", instance:name())
-- we need to disable built and re-download and re-install it
instance:fallback_build()
print("download", instance:name(), scheduler.co_running())
action_download(instance)
print("install", instance:name(), scheduler.co_running())
action_install(instance)
print("install end", instance:name(), scheduler.co_running())
end
end

-- reset package status cache
_g.package_status_cache = nil

print("register_packages", instance:name(), scheduler.co_running())
-- register it to local cache if it is root required package
--
-- @note we need to register the package in time,
Expand Down Expand Up @@ -519,11 +523,6 @@ function _install_packages(packages_install, packages_download, installdeps)
isolate = true,
on_timer = function (running_jobs_indices)

-- do not print progress info if be verbose
if option.get("verbose") or not show_wait then
return
end

-- make installing and downloading packages list
local installing = {}
local downloading = {}
Expand Down

0 comments on commit 0135dd9

Please sign in to comment.