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.
208 209 210 211 |
# File 'lib/logging/utils.rb', line 208 def initialize super @locker = nil end |
Instance Method Details
#original_synchronize ⇒ Object
213 |
# File 'lib/logging/utils.rb', line 213 alias :original_synchronize :synchronize |
#synchronize ⇒ Object
215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/logging/utils.rb', line 215 def synchronize if @locker == Thread.current yield else original_synchronize { begin @locker = Thread.current yield ensure @locker = nil end } end end |