mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib: do not use __send__ to access private methods. [ruby-dev:26935]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b6a9db5005
commit
f42208b70c
15 changed files with 54 additions and 46 deletions
|
@ -87,11 +87,11 @@ module MonitorMixin
|
|||
class Timeout < Exception; end
|
||||
|
||||
def wait(timeout = nil)
|
||||
@monitor.__send__(:mon_check_owner)
|
||||
@monitor.instance_eval {mon_check_owner()}
|
||||
timer = create_timer(timeout)
|
||||
|
||||
Thread.critical = true
|
||||
count = @monitor.__send__(:mon_exit_for_cond)
|
||||
count = @monitor.instance_eval {mon_exit_for_cond()}
|
||||
@waiters.push(Thread.current)
|
||||
|
||||
begin
|
||||
|
@ -107,7 +107,7 @@ module MonitorMixin
|
|||
if @waiters.include?(Thread.current) # interrupted?
|
||||
@waiters.delete(Thread.current)
|
||||
end
|
||||
@monitor.__send__(:mon_enter_for_cond, count)
|
||||
@monitor.instance_eval {mon_enter_for_cond(count)}
|
||||
Thread.critical = false
|
||||
end
|
||||
end
|
||||
|
@ -125,7 +125,7 @@ module MonitorMixin
|
|||
end
|
||||
|
||||
def signal
|
||||
@monitor.__send__(:mon_check_owner)
|
||||
@monitor.instance_eval {mon_check_owner()}
|
||||
Thread.critical = true
|
||||
t = @waiters.shift
|
||||
t.wakeup if t
|
||||
|
@ -134,7 +134,7 @@ module MonitorMixin
|
|||
end
|
||||
|
||||
def broadcast
|
||||
@monitor.__send__(:mon_check_owner)
|
||||
@monitor.instance_eval {mon_check_owner()}
|
||||
Thread.critical = true
|
||||
for t in @waiters
|
||||
t.wakeup
|
||||
|
@ -172,7 +172,7 @@ module MonitorMixin
|
|||
|
||||
def self.extend_object(obj)
|
||||
super(obj)
|
||||
obj.__send__(:mon_initialize)
|
||||
obj.instance_eval {mon_initialize()}
|
||||
end
|
||||
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue