diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-02 04:59:43 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-02 04:59:43 +0000 |
commit | 8eeaf69e52b648ff8d7564cd991db7409a43a941 (patch) | |
tree | 0014e172cea47c9bb647a90a412c0e3857ae4a99 /lib/monitor.rb | |
parent | 3c0af9ca44350a5a5f6d303af9da7c5f4d7f1ea9 (diff) | |
download | ruby-8eeaf69e52b648ff8d7564cd991db7409a43a941.tar.gz |
* lib/monitor.rb (wait): ensure reentrance.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/monitor.rb')
-rw-r--r-- | lib/monitor.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/monitor.rb b/lib/monitor.rb index 7cca6e871e..d36546ab6d 100644 --- a/lib/monitor.rb +++ b/lib/monitor.rb @@ -93,21 +93,20 @@ module MonitorMixin rescue Timeout @waiters.delete(Thread.current) ensure + Thread.critical = true if timeout && timeout_thread.alive? Thread.kill(timeout_thread) end + while @monitor.mon_owner && + @monitor.mon_owner != Thread.current + @monitor.mon_waiting_queue.push(Thread.current) + Thread.stop + Thread.critical = true + end + @monitor.mon_owner = Thread.current + @monitor.mon_count = count + Thread.critical = false end - - Thread.critical = true - while @monitor.mon_owner && - @monitor.mon_owner != Thread.current - @monitor.mon_waiting_queue.push(Thread.current) - Thread.stop - Thread.critical = true - end - @monitor.mon_owner = Thread.current - @monitor.mon_count = count - Thread.critical = false end def wait_while |