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.
178 179 180 181 |
# File 'lib/logging/utils.rb', line 178 def initialize super @locker = nil end |
Instance Method Details
#original_synchronize ⇒ Object
183 |
# File 'lib/logging/utils.rb', line 183 alias :original_synchronize :synchronize |
#synchronize ⇒ Object
185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/logging/utils.rb', line 185 def synchronize if @locker == Thread.current yield else original_synchronize { begin @locker = Thread.current yield ensure @locker = nil end } end end |