Module: FiniteMachine::TwoPhaseLock Private

Defined in:
lib/finite_machine/two_phase_lock.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Mixin to provide lock to a Threadable

Class Method Summary collapse

Class Method Details

.lockSync

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.

Create synchronization lock

Returns:

  • (Sync)


15
16
17
# File 'lib/finite_machine/two_phase_lock.rb', line 15

def lock
  @lock = Sync.new
end

.synchronize(mode, &block) ⇒ nil

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.

Synchronize given block of code

Parameters:

  • mode (Symbol)

    the lock mode out of :SH, :EX, :UN

Returns:

  • (nil)


28
29
30
# File 'lib/finite_machine/two_phase_lock.rb', line 28

def synchronize(mode, &block)
  lock.synchronize(mode, &block)
end