module Mutex_m

mutex_m.rb

When ‘mutex_m’ is required, any object that extends or includes Mutex_m will be treated like a Mutex.

Start by requiring the standard library Mutex_m:

require "mutex_m"

From here you can extend an object with Mutex instance methods:

obj = Object.new
obj.extend Mutex_m

Or mixin Mutex_m into your module to your class inherit Mutex instance methods — remember to call super() in your class initialize method.

class Foo
  include Mutex_m
  def initialize
    # ...
    super()
  end
  # ...
end
obj = Foo.new
# this obj can be handled like Mutex

Constants

VERSION

Public Instance Methods

mu_lock() click to toggle source

See Thread::Mutex#lock

# File mutex_m-0.3.0/lib/mutex_m.rb, line 96
def mu_lock
  @_mutex.lock
end
mu_locked?() click to toggle source

See Thread::Mutex#locked?

# File mutex_m-0.3.0/lib/mutex_m.rb, line 86
def mu_locked?
  @_mutex.locked?
end
mu_synchronize(&block) click to toggle source

See Thread::Mutex#synchronize

# File mutex_m-0.3.0/lib/mutex_m.rb, line 81
def mu_synchronize(&block)
  @_mutex.synchronize(&block)
end
mu_try_lock() click to toggle source

See Thread::Mutex#try_lock

# File mutex_m-0.3.0/lib/mutex_m.rb, line 91
def mu_try_lock
  @_mutex.try_lock
end
mu_unlock() click to toggle source

See Thread::Mutex#unlock

# File mutex_m-0.3.0/lib/mutex_m.rb, line 101
def mu_unlock
  @_mutex.unlock
end
sleep(timeout = nil) click to toggle source

See Thread::Mutex#sleep

# File mutex_m-0.3.0/lib/mutex_m.rb, line 106
def sleep(timeout = nil)
  @_mutex.sleep(timeout)
end