mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
3ba5337dfa
commit
60f289bf26
3 changed files with 15 additions and 9 deletions
|
@ -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>
|
Sun Jan 2 01:17:17 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||||
|
|
||||||
* test/drb/drbtest.rb: add method DRbService.ext_service.
|
* test/drb/drbtest.rb: add method DRbService.ext_service.
|
||||||
|
|
|
@ -1333,7 +1333,11 @@ module DRb
|
||||||
|
|
||||||
# Stop this server.
|
# Stop this server.
|
||||||
def stop_service
|
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
|
end
|
||||||
|
|
||||||
# Convert a dRuby reference to the local object it refers to.
|
# Convert a dRuby reference to the local object it refers to.
|
||||||
|
@ -1518,10 +1522,11 @@ module DRb
|
||||||
end
|
end
|
||||||
client.send_reply(succ, result) rescue nil
|
client.send_reply(succ, result) rescue nil
|
||||||
ensure
|
ensure
|
||||||
unless succ
|
client.close unless succ
|
||||||
client.close
|
if Thread.current['DRb']['stop_service']
|
||||||
break
|
Thread.new { stop_service }
|
||||||
end
|
end
|
||||||
|
break unless succ
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,10 +25,7 @@ module DRb
|
||||||
@invoker.unregist(@name)
|
@invoker.unregist(@name)
|
||||||
server = @server
|
server = @server
|
||||||
@server = nil
|
@server = nil
|
||||||
Thread.new do
|
server.stop_service
|
||||||
sleep 1
|
|
||||||
server.stop_service
|
|
||||||
end
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue