class Concurrent::Synchronization::MriMutexLockableObject

@!visibility private @!macro internal_implementation_note

Public Class Methods

new(*defaults) click to toggle source
Calls superclass method Concurrent::Synchronization::Object.new
# File lib/concurrent/synchronization/mri_lockable_object.rb, line 26
def initialize(*defaults)
  super(*defaults)
  @__lock__      = ::Mutex.new
  @__condition__ = ::ConditionVariable.new
end

Protected Instance Methods

ns_wait(timeout = nil) click to toggle source
# File lib/concurrent/synchronization/mri_lockable_object.rb, line 42
def ns_wait(timeout = nil)
  @__condition__.wait @__lock__, timeout
  self
end
synchronize() { || ... } click to toggle source
# File lib/concurrent/synchronization/mri_lockable_object.rb, line 34
def synchronize
  if @__lock__.owned?
    yield
  else
    @__lock__.synchronize { yield }
  end
end