Class: Sidekiq::Portal::Lock Private

Inherits:
Object
  • Object
show all
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.

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initializevoid

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.

Since:

  • 0.1.0



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.

Since:

  • 0.1.0



19
20
21
# File 'lib/portal/lock.rb', line 19

def thread_safe(&block)
  lock.owned? ? yield : lock.synchronize(&block)
end