зеркало из https://github.com/github/ruby.git
[ruby/timeout] Synchronize all accesses to @done
* So it is trivially correct. * Performance seems the same overall. https://github.com/ruby/timeout/commit/5e0d8e1637
This commit is contained in:
Родитель
354cd6f210
Коммит
240ac9eaa8
|
@ -67,11 +67,13 @@ module Timeout
|
|||
@message = message
|
||||
|
||||
@mutex = Mutex.new
|
||||
@done = false
|
||||
@done = false # protected by @mutex
|
||||
end
|
||||
|
||||
def done?
|
||||
@done
|
||||
@mutex.synchronize do
|
||||
@done
|
||||
end
|
||||
end
|
||||
|
||||
def expired?(now)
|
||||
|
|
Загрузка…
Ссылка в новой задаче