Class: Qonfig::Settings::Lock Private
- Inherits:
-
Object
- Object
- Qonfig::Settings::Lock
- Defined in:
- lib/qonfig/settings/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 ⇒ Lock
constructor
private
A new instance of Lock.
- #thread_safe_access(&instructions) ⇒ Object private
- #thread_safe_definition(&instructions) ⇒ Object private
- #thread_safe_merge(&instructions) ⇒ Object private
Constructor Details
#initialize ⇒ Lock
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.
Returns a new instance of Lock.
8 9 10 11 12 |
# File 'lib/qonfig/settings/lock.rb', line 8 def initialize @definition_lock = Mutex.new @access_lock = Mutex.new @merge_lock = Mutex.new end |
Instance Method Details
#thread_safe_access(&instructions) ⇒ Object
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.
28 29 30 |
# File 'lib/qonfig/settings/lock.rb', line 28 def thread_safe_access(&instructions) access_lock.owned? ? yield : access_lock.synchronize(&instructions) end |
#thread_safe_definition(&instructions) ⇒ Object
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/qonfig/settings/lock.rb', line 19 def thread_safe_definition(&instructions) definition_lock.owned? ? yield : definition_lock.synchronize(&instructions) end |
#thread_safe_merge(&instructions) ⇒ Object
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.
37 38 39 |
# File 'lib/qonfig/settings/lock.rb', line 37 def thread_safe_merge(&instructions) merge_lock.owned? ? yield : merge_lock.synchronize(&instructions) end |