* lib/thread.rb (Queue#pop): fix a race against Thread.wakeup.
Patch by Masaki Matsushita <glass.saga at gmail dot com> [Bug #5195] [ruby-dev:44400] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3ffa44622d
commit
2dd9d721ed
@ -1,3 +1,9 @@
|
|||||||
|
Tue Aug 30 09:57:50 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
|
* lib/thread.rb (Queue#pop): fix a race against Thread.wakeup.
|
||||||
|
Patch by Masaki Matsushita <glass.saga at gmail dot com>
|
||||||
|
[Bug #5195] [ruby-dev:44400]
|
||||||
|
|
||||||
Tue Aug 30 09:48:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Tue Aug 30 09:48:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* cont.c (fiber_entry): fix stack allocation failure on Debian
|
* cont.c (fiber_entry): fix stack allocation failure on Debian
|
||||||
|
@ -185,7 +185,9 @@ class Queue
|
|||||||
while true
|
while true
|
||||||
if @que.empty?
|
if @que.empty?
|
||||||
raise ThreadError, "queue empty" if non_block
|
raise ThreadError, "queue empty" if non_block
|
||||||
@waiting.push Thread.current
|
# @waiting.include? check is necessary for avoiding a race against
|
||||||
|
# Thread.wakeup [Bug 5195]
|
||||||
|
@waiting.push Thread.current unless @waiting.include?(Thread.current)
|
||||||
@mutex.sleep
|
@mutex.sleep
|
||||||
else
|
else
|
||||||
return @que.shift
|
return @que.shift
|
||||||
|
Loading…
x
Reference in New Issue
Block a user