class Concurrent::Synchronization::MutexLockableObject

@!visibility private @!macro internal_implementation_note

Public Class Methods

new() click to toggle source
# File lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb, line 30
def initialize
  super()
  @__Lock__      = ::Mutex.new
  @__Condition__ = ::ConditionVariable.new
end

Public Instance Methods

initialize_copy(other) click to toggle source
Calls superclass method
# File lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb, line 36
def initialize_copy(other)
  super
  @__Lock__      = ::Mutex.new
  @__Condition__ = ::ConditionVariable.new
end

Protected Instance Methods

ns_wait(timeout = nil) click to toggle source
# File lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb, line 52
def ns_wait(timeout = nil)
  @__Condition__.wait @__Lock__, timeout
  self
end
synchronize() { || ... } click to toggle source
# File lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb, line 44
def synchronize
  if @__Lock__.owned?
    yield
  else
    @__Lock__.synchronize { yield }
  end
end