mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/timeout] Synchronize all accesses to @done
* So it is trivially correct.
* Performance seems the same overall.
5e0d8e1637
This commit is contained in:
parent
354cd6f210
commit
240ac9eaa8
1 changed files with 4 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue