From 15e5d1542427c794de853b35ff50d49c4ca33504 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 23 May 2017 14:12:38 -0400 Subject: [PATCH] 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. --- lib/rscons/environment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index 8a4ee5d..58b68b0 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -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