diff options
author | Benoit Daloze <[email protected]> | 2022-05-15 13:49:31 +0200 |
---|---|---|
committer | git <[email protected]> | 2022-05-19 07:19:41 +0900 |
commit | 240ac9eaa8d3dab8f7dd5f29f67c7ee8d4d05d86 (patch) | |
tree | 503dfdef9b80d49d558dacaee338b39ae916bc34 /lib/timeout.rb | |
parent | 354cd6f210c966327b1adffc0b81990827b77a0d (diff) |
[ruby/timeout] Synchronize all accesses to @done
* So it is trivially correct.
* Performance seems the same overall.
https://github.com/ruby/timeout/commit/5e0d8e1637
Diffstat (limited to 'lib/timeout.rb')
-rw-r--r-- | lib/timeout.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/timeout.rb b/lib/timeout.rb index 414983088c..4659ec3279 100644 --- a/lib/timeout.rb +++ b/lib/timeout.rb @@ -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) |