bug fix for obj.extend(Mutex_m).

This is patched by akira yamada.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
keiju 2001-06-06 09:13:14 +00:00
parent f0ccffd530
commit b2658a3d83

View File

@ -1,10 +1,12 @@
# #
# mutex_m.rb - # mutex_m.rb -
# $Release Version: 2.0$ # $Release Version: 3.0$
# $Revision: 1.7 $ # $Revision: 1.7 $
# $Date: 1998/02/27 04:28:57 $ # $Date: 1998/02/27 04:28:57 $
# Original from mutex.rb # Original from mutex.rb
# by Keiju ISHITSUKA(SHL Japan Inc.) # by Keiju ISHITSUKA(keiju@ishitsuka.com)
# modified by matz
# patched by akira yamada
# #
# -- # --
# Usage: # Usage:
@ -13,10 +15,18 @@
# obj.extend Mutex_m # obj.extend Mutex_m
# ... # ...
# extended object can be handled like Mutex # extended object can be handled like Mutex
# or
# class Foo
# include Mutex_m
# ...
# end
# obj = Foo.new
# this obj can be handled like Mutex
# #
module Mutex_m module Mutex_m
def Mutex_m.included(cl) def Mutex_m.append_features(cl)
super
unless cl.instance_of?(Module) unless cl.instance_of?(Module)
cl.module_eval %q{ cl.module_eval %q{
alias locked? mu_locked? alias locked? mu_locked?
@ -26,7 +36,7 @@ module Mutex_m
alias synchronize mu_synchronize alias synchronize mu_synchronize
} }
end end
return self self
end end
def Mutex_m.extend_object(obj) def Mutex_m.extend_object(obj)
@ -48,7 +58,7 @@ module Mutex_m
alias synchronize mu_synchronize alias synchronize mu_synchronize
end" end"
end end
initialize mu_initialize
end end
# locking # locking
@ -101,10 +111,13 @@ module Mutex_m
private private
def initialize(*args) def mu_initialize
ret = super
@mu_waiting = [] @mu_waiting = []
@mu_locked = false; @mu_locked = false;
return ret end
def initialize(*args)
mu_initialize
super
end end
end end