actually honor sync requests

main
Codinget 4 years ago
parent e5bd85933a
commit 6a6334fc78
  1. 6
      moonbuild/core/DAG.moon
  2. 8
      moonbuild/core/multiprocessexecutor.moon
  3. 15
      out/moonbuild

@ -12,6 +12,8 @@ nodepriority = (a, b) ->
tb = type b.name
da = #a.deps
db = #b.deps
sa = a.sync
sb = b.sync
if ta=='string' and tb!='string'
return true
elseif ta!='string' and tb=='string'
@ -20,6 +22,10 @@ nodepriority = (a, b) ->
return true
elseif a.priority < b.priority
return false
elseif sa and not sb
return false
elseif sb and not sa
return true
else
return da < db

@ -37,6 +37,14 @@ class Executor
error "Node #{name} wasn't built" unless node.built
addprocess: (node, opts) =>
if node.sync
while @nprocesses != 0
@waitprocess
node\build opts
node.built = true
node\updatecache!
return
pid = fork!
error "Failed to fork" unless pid
if pid!=0

@ -1670,6 +1670,8 @@ nodepriority = function(a, b)
local tb = type(b.name)
local da = #a.deps
local db = #b.deps
local sa = a.sync
local sb = b.sync
if ta == 'string' and tb ~= 'string' then
return true
elseif ta ~= 'string' and tb == 'string' then
@ -1678,6 +1680,10 @@ nodepriority = function(a, b)
return true
elseif a.priority < b.priority then
return false
elseif sa and not sb then
return false
elseif sb and not sa then
return true
else
return da < db
end
@ -2248,6 +2254,15 @@ do
end
end,
addprocess = function(self, node, opts)
if node.sync then
while self.nprocesses ~= 0 do
local _ = self.waitprocess
end
node:build(opts)
node.built = true
node:updatecache()
return
end
local pid = fork()
if not (pid) then
error("Failed to fork")

Loading…
Cancel
Save