Sha256: bd3a1687010ea52df3a27dcce34a7988f79ba5853db4b9850c7fe0788e3db911

Contents?: true

Size: 361 Bytes

Versions: 10

Compression:

Stored size: 361 Bytes

Contents

# frozen_string_literal: true

# @api public
# @since 0.4.0
class SmartCore::Engine::Lock
  # @return [void]
  #
  # @api public
  # @since 0.4.0
  def initialize
    @lock = Mutex.new
  end

  # @param block [Block]
  # @return [Any]
  #
  # @api public
  # @since 0.4.0
  def synchronize(&block)
    @lock.owned? ? yield : @lock.synchronize(&block)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
smart_engine-0.13.0 lib/smart_core/engine/lock.rb
smart_engine-0.12.0 lib/smart_core/engine/lock.rb
smart_engine-0.11.0 lib/smart_core/engine/lock.rb
smart_engine-0.10.0 lib/smart_core/engine/lock.rb
smart_engine-0.9.0 lib/smart_core/engine/lock.rb
smart_engine-0.8.0 lib/smart_core/engine/lock.rb
smart_engine-0.7.0 lib/smart_core/engine/lock.rb
smart_engine-0.6.0 lib/smart_core/engine/lock.rb
smart_engine-0.5.0 lib/smart_core/engine/lock.rb
smart_engine-0.4.0 lib/smart_core/engine/lock.rb