[ruby/timeout] Set the flag surely before return
https://github.com/ruby/timeout/commit/f3a31abdfb
This commit is contained in:
parent
1528770794
commit
cd6f87eefc
@ -98,8 +98,7 @@ module Timeout
|
|||||||
private_constant :Request
|
private_constant :Request
|
||||||
|
|
||||||
def self.create_timeout_thread
|
def self.create_timeout_thread
|
||||||
Thread.new do
|
watcher = Thread.new do
|
||||||
Thread.current.thread_variable_set(:"\0__detached_thread__", true)
|
|
||||||
requests = []
|
requests = []
|
||||||
while true
|
while true
|
||||||
until QUEUE.empty? and !requests.empty? # wait to have at least one request
|
until QUEUE.empty? and !requests.empty? # wait to have at least one request
|
||||||
@ -121,6 +120,8 @@ module Timeout
|
|||||||
requests.reject!(&:done?)
|
requests.reject!(&:done?)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
watcher.thread_variable_set(:"\0__detached_thread__", true)
|
||||||
|
watcher
|
||||||
end
|
end
|
||||||
private_class_method :create_timeout_thread
|
private_class_method :create_timeout_thread
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user