Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit 3821b51

Browse files
author
Brian Durand
committed
fix rdoc and remove warnings
1 parent 029c1e1 commit 3821b51

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/ref/safe_monitor.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
# Threads not available. Monitor will do nothing.
55
end
66

7-
# The Monitor class in Ruby 1.8 has some bugs and also threads may not be available on all
8-
# runtimes. This class provides a simple, safe alternative.
97
module Ref
8+
# The Monitor class in Ruby 1.8 has some bugs and also threads may not be available on all
9+
# runtimes. This class provides a simple, safe re-entrant mutex as an alternative.
1010
class SafeMonitor
1111
def initialize
1212
@owner = nil
1313
@count = 0
14-
@mutex = Mutex.new if defined?(Mutex)
14+
@mutex = defined?(Mutex) ? Mutex.new : nil
1515
end
1616

1717
# Acquire an exclusive lock.

0 commit comments

Comments
 (0)