diff --git a/ChangeLog b/ChangeLog index 1b984a89fd..418710f9e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Jan 2 15:42:10 2005 Masatoshi SEKI + + * lib/drb/drb.rb: add lazy stop_service. + Sun Jan 2 01:17:17 2005 Masatoshi SEKI * test/drb/drbtest.rb: add method DRbService.ext_service. diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb index 210e16da24..78cf482c86 100644 --- a/lib/drb/drb.rb +++ b/lib/drb/drb.rb @@ -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 diff --git a/lib/drb/extserv.rb b/lib/drb/extserv.rb index 4ed2913051..7da8130c2b 100644 --- a/lib/drb/extserv.rb +++ b/lib/drb/extserv.rb @@ -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