diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/monitor.rb | 21 |
2 files changed, 14 insertions, 11 deletions
@@ -1,3 +1,7 @@ +Mon Apr 2 13:54:21 2001 Shugo Maeda <shugo@ruby-lang.org> + + * lib/monitor.rb (wait): ensure reentrance. + Mon Apr 2 12:40:45 2001 Shugo Maeda <shugo@ruby-lang.org> * lib/net/imap.rb (media_subtype): return subtype. 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 |