зеркало из https://github.com/github/ruby.git
add lazy stop_service
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3ba5337dfa
Коммит
60f289bf26
|
@ -1,3 +1,7 @@
|
|||
Sun Jan 2 15:42:10 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||
|
||||
* lib/drb/drb.rb: add lazy stop_service.
|
||||
|
||||
Sun Jan 2 01:17:17 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||
|
||||
* test/drb/drbtest.rb: add method DRbService.ext_service.
|
||||
|
|
|
@ -1333,7 +1333,11 @@ module DRb
|
|||
|
||||
# Stop this server.
|
||||
def stop_service
|
||||
@thread.kill
|
||||
if Thread.current['DRb'] && Thread.current['DRb']['server'] == self
|
||||
Thread.current['DRb']['stop_service'] = true
|
||||
else
|
||||
@thread.kill
|
||||
end
|
||||
end
|
||||
|
||||
# Convert a dRuby reference to the local object it refers to.
|
||||
|
@ -1518,10 +1522,11 @@ module DRb
|
|||
end
|
||||
client.send_reply(succ, result) rescue nil
|
||||
ensure
|
||||
unless succ
|
||||
client.close
|
||||
break
|
||||
end
|
||||
client.close unless succ
|
||||
if Thread.current['DRb']['stop_service']
|
||||
Thread.new { stop_service }
|
||||
end
|
||||
break unless succ
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,10 +25,7 @@ module DRb
|
|||
@invoker.unregist(@name)
|
||||
server = @server
|
||||
@server = nil
|
||||
Thread.new do
|
||||
sleep 1
|
||||
server.stop_service
|
||||
end
|
||||
server.stop_service
|
||||
true
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче