summaryrefslogtreecommitdiff
path: root/lib/timeout.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/timeout.rb')
-rw-r--r--lib/timeout.rb6
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)