# frozen_string_literal: false
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
# patched by akira yamada
# 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:
# From here you can extend an object with Mutex instance methods:
# Or mixin Mutex_m into your module to your class inherit Mutex instance
# # this obj can be handled like Mutex
def Mutex_m.define_aliases(cl) # :nodoc:
alias try_lock mu_try_lock
alias synchronize mu_synchronize
def Mutex_m.append_features(cl) # :nodoc:
define_aliases(cl) unless cl.instance_of?(Module)
def Mutex_m.extend_object(obj) # :nodoc:
def mu_extended # :nodoc:
unless (defined? locked? and
Mutex_m.define_aliases(singleton_class)
def mu_synchronize(&block)
@_mutex.synchronize(&block)
def mu_initialize # :nodoc:
@_mutex = Thread::Mutex.new
def initialize(*args) # :nodoc: