module Mutex_m

def initialize(*args) # :nodoc:

:nodoc:
def initialize(*args) # :nodoc:
  mu_initialize
  super
end

def mu_extended # :nodoc:

:nodoc:
def mu_extended # :nodoc:
  unless (defined? locked? and
          defined? lock and
          defined? unlock and
          defined? try_lock and
          defined? synchronize)
    Mutex_m.define_aliases(singleton_class)
  end
  mu_initialize
end

def mu_initialize # :nodoc:

:nodoc:
def mu_initialize # :nodoc:
  @_mutex = Thread::Mutex.new
end

def mu_lock

See Thread::Mutex#lock
def mu_lock
  @_mutex.lock
end

def mu_locked?

See Thread::Mutex#locked?
def mu_locked?
  @_mutex.locked?
end

def mu_synchronize(&block)

See Thread::Mutex#synchronize
def mu_synchronize(&block)
  @_mutex.synchronize(&block)
end

def mu_try_lock

See Thread::Mutex#try_lock
def mu_try_lock
  @_mutex.try_lock
end

def mu_unlock

See Thread::Mutex#unlock
def mu_unlock
  @_mutex.unlock
end

def sleep(timeout = nil)

See Thread::Mutex#sleep
def sleep(timeout = nil)
  @_mutex.sleep(timeout)
end