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

* lib/generator.rb: (Generator#initialize) ensured to stop @loop_thread.

Mr. Tanaka pointed out one Thread.pass is not enough. [ruby-dev:28185]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ocean 2005-12-30 06:23:25 +00:00
parent 5f82802aec
commit e052495637
2 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Fri Dec 30 15:17:35 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* lib/generator.rb: (Generator#initialize) ensured to stop @loop_thread.
Mr. Tanaka pointed out one Thread.pass is not enough. [ruby-dev:28185]
Fri Dec 30 12:20:57 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp> Fri Dec 30 12:20:57 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
* lib/generator.rb: (Generator#initialize) fixed dead lock. this occured * lib/generator.rb: (Generator#initialize) fixed dead lock. this occured

View file

@ -74,14 +74,14 @@ class Generator
@loop_thread = Thread.new do @loop_thread = Thread.new do
Thread.stop Thread.stop
begin begin
@block.call(self) # exception safe? @block.call(self)
rescue rescue
@main_thread.raise $! @main_thread.raise
ensure ensure
@main_thread.wakeup @main_thread.wakeup
end end
end end
Thread.pass # ensure @loop_thread to be stopped Thread.pass until @loop_thread.stop?
self self
end end