We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 227037e commit 5ac9df0Copy full SHA for 5ac9df0
lib/rake/thread_pool.rb
@@ -109,13 +109,19 @@ def process_queue_item #:nodoc:
109
false
110
end
111
112
+ def safe_thread_count
113
+ @threads_mon.synchronize do
114
+ @threads.count
115
+ end
116
117
+
118
def start_thread # :nodoc:
119
@threads_mon.synchronize do
120
next unless @threads.count < @max_active_threads
121
122
t = Thread.new do
123
begin
- while @threads.count <= @max_active_threads
124
+ while safe_thread_count <= @max_active_threads
125
break unless process_queue_item
126
127
ensure
@@ -126,6 +132,7 @@ def start_thread # :nodoc:
132
133
128
134
135
129
136
@threads << t
130
137
stat(
131
138
:spawned,
0 commit comments