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/branches/ruby_1_8@7979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a3eb5e75bb
commit
fe85864b90
3 changed files with 17 additions and 9 deletions
|
|
@ -1,3 +1,9 @@
|
|||
Wed Feb 16 23:34:30 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||
|
||||
* lib/drb/drb.rb: add lazy stop_service. ([druby-ja:109])
|
||||
|
||||
* lib/drb/extserv.rb: ditto.
|
||||
|
||||
Wed Feb 16 17:07:57 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/tkutil.c: Follow the change of st.c (st_foreach)
|
||||
|
|
|
|||
|
|
@ -1352,8 +1352,12 @@ module DRb
|
|||
|
||||
# Stop this server.
|
||||
def stop_service
|
||||
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.
|
||||
def to_obj(ref)
|
||||
|
|
@ -1556,10 +1560,11 @@ module DRb
|
|||
end
|
||||
client.send_reply(succ, result) rescue nil
|
||||
ensure
|
||||
unless succ
|
||||
client.close
|
||||
break
|
||||
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
|
||||
true
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue