Files

Class/Module Index [+]

Quicksearch

Concurrent::Synchronization::MutexObject

@!visibility private @!macro internal_implementation_note

Public Class Methods

new() click to toggle source
# File lib/concurrent/synchronization/mutex_object.rb, line 7
def initialize
  @__lock__      = ::Mutex.new
  @__condition__ = ::ConditionVariable.new
end

Protected Instance Methods

ensure_ivar_visibility!() click to toggle source
# File lib/concurrent/synchronization/mutex_object.rb, line 37
def ensure_ivar_visibility!
  # relying on undocumented behavior of CRuby, GVL acquire has lock which ensures visibility of ivars
  # https://github.com/ruby/ruby/blob/ruby_2_2/thread_pthread.c#L204-L211
end
ns_broadcast() click to toggle source
# File lib/concurrent/synchronization/mutex_object.rb, line 27
def ns_broadcast
  @__condition__.broadcast
  self
end
ns_signal() click to toggle source
# File lib/concurrent/synchronization/mutex_object.rb, line 22
def ns_signal
  @__condition__.signal
  self
end
ns_wait(timeout = nil) click to toggle source
# File lib/concurrent/synchronization/mutex_object.rb, line 32
def ns_wait(timeout = nil)
  @__condition__.wait @__lock__, timeout
  self
end
synchronize() click to toggle source
# File lib/concurrent/synchronization/mutex_object.rb, line 14
def synchronize
  if @__lock__.owned?
    yield
  else
    @__lock__.synchronize { yield }
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.