Bug #14171 ยป 0001-Avoid-creating-a-Thread-for-shutting-down-a-DRbServe.patch
lib/drb/drb.rb | ||
---|---|---|
if Thread.current['DRb'] && Thread.current['DRb']['server'] == self
|
||
Thread.current['DRb']['stop_service'] = true
|
||
else
|
||
if @protocol.respond_to? :shutdown
|
||
@protocol.shutdown
|
||
else
|
||
[@thread, *@grp.list].each {|thread| thread.kill} # xxx: Thread#kill
|
||
end
|
||
@thread.join
|
||
shutdown
|
||
end
|
||
end
|
||
... | ... | |
private
|
||
def shutdown
|
||
current = Thread.current
|
||
if @protocol.respond_to? :shutdown
|
||
@protocol.shutdown
|
||
else
|
||
[@thread, *@grp.list].each { |thread|
|
||
thread.kill unless thread == current # xxx: Thread#kill
|
||
}
|
||
end
|
||
@thread.join unless @thread == current
|
||
end
|
||
##
|
||
# Starts the DRb main loop in a new thread.
|
||
... | ... | |
error_print(e) if verbose
|
||
ensure
|
||
client.close unless succ
|
||
if Thread.current['DRb']['stop_service']
|
||
Thread.new { stop_service }
|
||
end
|
||
shutdown if Thread.current['DRb']['stop_service']
|
||
break unless succ
|
||
end
|
||
end
|