1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) 25420:

* lib/monitor.rb (MonitorMixin.mon_release): ensure the scheduled
	  thread to be alive when a thread is releasing a monitor. #2240


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@25916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shyouhei 2009-11-25 07:45:29 +00:00
parent 61087d93c5
commit c3d27c35fe
4 changed files with 42 additions and 4 deletions

View file

@ -288,11 +288,15 @@ module MonitorMixin
@mon_owner = Thread.current
end
# mon_release requires Thread.critical == true
def mon_release
@mon_owner = nil
t = @mon_waiting_queue.shift
t = @mon_entering_queue.shift unless t
t.wakeup if t
while t = @mon_waiting_queue.shift || @mon_entering_queue.shift
if t.alive?
t.wakeup
return
end
end
end
def mon_enter_for_cond(count)