summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authortake-cheeze <[email protected]>2018-06-22 11:41:12 +0900
committertake-cheeze <[email protected]>2018-06-22 11:41:12 +0900
commit48ba7c7bb0ccf146921e585c6ce2f5a0e1afff0f (patch)
tree864549821f7586302e236e2fea347a9a2d2acb86
parent36714043912372c11cf361fb2a37130be6b853d7 (diff)
downloadmruby-48ba7c7bb0ccf146921e585c6ce2f5a0e1afff0f.tar.gz
mruby-48ba7c7bb0ccf146921e585c6ce2f5a0e1afff0f.zip
Increase sleep duration exponentially instead of `Thread.pass`.
-rwxr-xr-xminirake9
1 files changed, 6 insertions, 3 deletions
diff --git a/minirake b/minirake
index e16dd5bcf..8b6bfa296 100755
--- a/minirake
+++ b/minirake
@@ -562,8 +562,9 @@ class RakeApp
exit 1
end
- def wait_process
- Thread.pass
+ def wait_process(count = 0)
+ dur = [0.0001 * (10 ** count), 1].min
+ sleep dur
exited = []
$rake_fiber_table.each do |pid, v|
@@ -581,10 +582,12 @@ class RakeApp
raise "Command Failed: [#{ent[:command]}]"
end
- wait_process while $rake_fiber_table.size >= $rake_jobs
+ fail 'task scheduling bug!' if $rake_fiber_table.size >= $rake_jobs
ent[:fiber].transfer
end
+
+ wait_process(count + 1) if !$rake_fiber_table.empty? && exited.empty?
end
end