Class: SmartCore::Engine::Lock
- Inherits:
-
Object
- Object
- SmartCore::Engine::Lock
- Defined in:
- lib/smart_core/engine/lock.rb
Overview
Instance Method Summary collapse
- #initialize ⇒ void constructor
- #synchronize(&block) ⇒ Any
Constructor Details
#initialize ⇒ void
10 11 12 |
# File 'lib/smart_core/engine/lock.rb', line 10 def initialize @lock = ::Mutex.new end |
Instance Method Details
#synchronize(&block) ⇒ Any
19 20 21 |
# File 'lib/smart_core/engine/lock.rb', line 19 def synchronize(&block) @lock.owned? ? yield : @lock.synchronize(&block) end |