From 240ac9eaa8d3dab8f7dd5f29f67c7ee8d4d05d86 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sun, 15 May 2022 13:49:31 +0200 Subject: [ruby/timeout] Synchronize all accesses to @done * So it is trivially correct. * Performance seems the same overall. https://github.com/ruby/timeout/commit/5e0d8e1637 --- lib/timeout.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/timeout.rb') 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) -- cgit v1.2.3