Avoid Environment#process race condition

Race condition could have occurred if the last threaded command
was gathered in the non-blocking wait and then a blocking wait was
started because there was no job to run. Do not do a blocking wait
in this case.
This commit is contained in:
Josh Holtrop 2017-05-23 14:12:38 -04:00
parent a99e6e81b2
commit 15e5d15424

View File

@ -317,7 +317,7 @@ module Rscons
end
# If needed, do a blocking wait.
if job.nil? or @threaded_commands.size >= Rscons.n_threads
if (completed_tcs.empty? and job.nil?) or @threaded_commands.size >= Rscons.n_threads
completed_tcs << wait_for_threaded_commands
end