Class: ReentrantMutex
- Inherits:
-
Mutex
- Object
- Mutex
- ReentrantMutex
- Defined in:
- lib/logging/utils.rb
Overview
Instance Method Summary collapse
-
#initialize ⇒ ReentrantMutex
constructor
A new instance of ReentrantMutex.
- #original_synchronize ⇒ Object
- #synchronize ⇒ Object
Constructor Details
#initialize ⇒ ReentrantMutex
Returns a new instance of ReentrantMutex.
184 185 186 187 |
# File 'lib/logging/utils.rb', line 184 def initialize super @locker = nil end |
Instance Method Details
#original_synchronize ⇒ Object
189 |
# File 'lib/logging/utils.rb', line 189 alias :original_synchronize :synchronize |
#synchronize ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/logging/utils.rb', line 191 def synchronize if @locker == Thread.current yield else original_synchronize { begin @locker = Thread.current yield ensure @locker = nil end } end end |