e-threadpool 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/threadpool/core.rb +4 -4
- metadata +1 -1
data/lib/threadpool/core.rb
CHANGED
@@ -31,7 +31,7 @@ module Ethreadpool
|
|
31
31
|
worker = idle_worker
|
32
32
|
worker.nil? ? create_worker : break
|
33
33
|
|
34
|
-
# sleep here is a must, or MRI will get
|
34
|
+
# sleep here is a must, or MRI will get stuck
|
35
35
|
sleep(0.001)
|
36
36
|
end
|
37
37
|
|
@@ -43,8 +43,8 @@ module Ethreadpool
|
|
43
43
|
@checker_thread.join
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
47
|
-
busy_workers.
|
46
|
+
def idle?
|
47
|
+
busy_workers.empty?
|
48
48
|
end
|
49
49
|
|
50
50
|
private
|
@@ -63,7 +63,7 @@ module Ethreadpool
|
|
63
63
|
end
|
64
64
|
sleep(0.001)
|
65
65
|
|
66
|
-
if @teminate &&
|
66
|
+
if @teminate && idle? == 0
|
67
67
|
return
|
68
68
|
end
|
69
69
|
end
|