diff options
author | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-06-06 09:13:14 +0000 |
---|---|---|
committer | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-06-06 09:13:14 +0000 |
commit | b2658a3d839916db0cde8e810212932d1dc63cd5 (patch) | |
tree | cb0fca479542fc930ff90184aa4917cd4c819e52 /lib/mutex_m.rb | |
parent | f0ccffd530ff4faafe6f07df94818e807b96f851 (diff) |
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
Diffstat (limited to 'lib/mutex_m.rb')
-rw-r--r-- | lib/mutex_m.rb | 29 |
1 files changed, 21 insertions, 8 deletions
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 |