# $Date: 1998/02/27 04:28:57 $
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
# patched by akira yamada
# Extend an object and use it like a Mutex object:
# Or, include Mutex_m in a class to have its instances behave like a Mutex
def Mutex_m.define_aliases(cl)
alias try_lock mu_try_lock
alias synchronize mu_synchronize
def Mutex_m.append_features(cl)
define_aliases(cl) unless cl.instance_of?(Module)
def Mutex_m.extend_object(obj)
unless (defined? locked? and
Mutex_m.define_aliases(class<<self;self;end)
while (Thread.critical = true; @mu_locked)
@mu_waiting.push Thread.current