summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-22 18:35:20 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-22 18:35:20 +0000
commitb1bd8de6a62f7d8b37371b779ac7b152446bb01d (patch)
tree12a28a990f733e1249589bf3063901cfe93fb914 /lib
parent5115f2fba87a3725840e5ab9d0796fdc40c4e813 (diff)
merge -c 12193
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_5@12326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/monitor.rb21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/monitor.rb b/lib/monitor.rb
index 4ed4e41222..4c146c8086 100644
--- a/lib/monitor.rb
+++ b/lib/monitor.rb
@@ -105,14 +105,17 @@ module MonitorMixin
return false
ensure
Thread.critical = true
- if timer && timer.alive?
- Thread.kill(timer)
+ begin
+ if timer && timer.alive?
+ Thread.kill(timer)
+ end
+ if @waiters.include?(Thread.current) # interrupted?
+ @waiters.delete(Thread.current)
+ end
+ @monitor.instance_eval {mon_enter_for_cond(count)}
+ ensure
+ Thread.critical = false
end
- if @waiters.include?(Thread.current) # interrupted?
- @waiters.delete(Thread.current)
- end
- @monitor.instance_eval {mon_enter_for_cond(count)}
- Thread.critical = false
end
end
@@ -210,6 +213,7 @@ module MonitorMixin
Thread.critical = true
mon_acquire(@mon_entering_queue)
@mon_count += 1
+ ensure
Thread.critical = false
end
@@ -299,8 +303,9 @@ module MonitorMixin
def mon_exit_for_cond
count = @mon_count
@mon_count = 0
- mon_release
return count
+ ensure
+ mon_release
end
end