Class: SmartCore::Container::ArbitaryLock Private
- Inherits:
-
Object
- Object
- SmartCore::Container::ArbitaryLock
- Defined in:
- lib/smart_core/container/arbitary_lock.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #initialize ⇒ void constructor private
- #thread_safe(&block) ⇒ Any private
Constructor Details
#initialize ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/smart_core/container/arbitary_lock.rb', line 10 def initialize @lock = Mutex.new end |
Instance Method Details
#thread_safe(&block) ⇒ Any
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/smart_core/container/arbitary_lock.rb', line 19 def thread_safe(&block) @lock.owned? ? yield : @lock.synchronize(&block) end |