Sha256: d45d1f1ef9aaae31b4be2ae17e00efd2d18834dd4d5509ce941b6ab972c1ef89

Contents?: true

Size: 595 Bytes

Versions: 6

Compression:

Stored size: 595 Bytes

Contents

# encoding: utf-8

module FiniteMachine
  # Mixin to provide lock to a {Threadable}
  #
  # @api private
  module TwoPhaseLock
    # Create synchronization lock
    #
    # @return [Sync]
    #
    # @api private
    def sync
      @sync ||= Sync.new
    end

    # Synchronize given block of code
    #
    # @param [Symbol] mode
    #   the synchronization mode out of :SH and :EX
    #
    # @return [nil]
    #
    # @api private
    def synchronize(mode, &block)
      sync.synchronize(mode, &block)
    end

    module_function :sync, :synchronize
  end # TwoPhaseLock
end # FiniteMachine

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
finite_machine-0.11.1 lib/finite_machine/two_phase_lock.rb
finite_machine-0.11.0 lib/finite_machine/two_phase_lock.rb
finite_machine-0.10.2 lib/finite_machine/two_phase_lock.rb
finite_machine-0.10.1 lib/finite_machine/two_phase_lock.rb
finite_machine-0.10.0 lib/finite_machine/two_phase_lock.rb
finite_machine-0.9.2 lib/finite_machine/two_phase_lock.rb