Class: Sidekiq::Portal::Lock Private
- Inherits:
-
Object
- Object
- Sidekiq::Portal::Lock
- Defined in:
- lib/portal/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) ⇒ void 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/portal/lock.rb', line 10 def initialize @lock = Mutex.new end |
Instance Method Details
#thread_safe(&block) ⇒ 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.
This method returns an undefined value.
19 20 21 |
# File 'lib/portal/lock.rb', line 19 def thread_safe(&block) lock.owned? ? yield : lock.synchronize(&block) end |