From b2658a3d839916db0cde8e810212932d1dc63cd5 Mon Sep 17 00:00:00 2001 From: keiju Date: Wed, 6 Jun 2001 09:13:14 +0000 Subject: 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 --- lib/mutex_m.rb | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'lib/mutex_m.rb') diff --git a/lib/mutex_m.rb b/lib/mutex_m.rb index 1a3cd05856..fe05a45e9d 100644 --- a/lib/mutex_m.rb +++ b/lib/mutex_m.rb @@ -1,10 +1,12 @@ # # mutex_m.rb - -# $Release Version: 2.0$ +# $Release Version: 3.0$ # $Revision: 1.7 $ # $Date: 1998/02/27 04:28:57 $ # Original from mutex.rb -# by Keiju ISHITSUKA(SHL Japan Inc.) +# by Keiju ISHITSUKA(keiju@ishitsuka.com) +# modified by matz +# patched by akira yamada # # -- # Usage: @@ -13,10 +15,18 @@ # obj.extend Mutex_m # ... # 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 - def Mutex_m.included(cl) + def Mutex_m.append_features(cl) + super unless cl.instance_of?(Module) cl.module_eval %q{ alias locked? mu_locked? @@ -26,7 +36,7 @@ module Mutex_m alias synchronize mu_synchronize } end - return self + self end def Mutex_m.extend_object(obj) @@ -48,7 +58,7 @@ module Mutex_m alias synchronize mu_synchronize end" end - initialize + mu_initialize end # locking @@ -101,10 +111,13 @@ module Mutex_m private - def initialize(*args) - ret = super + def mu_initialize @mu_waiting = [] @mu_locked = false; - return ret + end + + def initialize(*args) + mu_initialize + super end end -- cgit v1.2.3