ruby-changes:52323
From: normal <ko1@a...>
Date: Sat, 25 Aug 2018 11:32:16 +0900 (JST)
Subject: [ruby-changes:52323] normal:r64531 (trunk): drb: simplify shutdown pipe close logic
normal 2018-08-25 11:32:10 +0900 (Sat, 25 Aug 2018) New Revision: 64531 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64531 Log: drb: simplify shutdown pipe close logic IO#close is idempotent, so we don't need to waste bytecode to check or nil it at shutdown time. Modified files: trunk/lib/drb/drb.rb Index: lib/drb/drb.rb =================================================================== --- lib/drb/drb.rb (revision 64530) +++ lib/drb/drb.rb (revision 64531) @@ -961,14 +961,8 @@ module DRb https://github.com/ruby/ruby/blob/trunk/lib/drb/drb.rb#L961 end def close_shutdown_pipe - if @shutdown_pipe_r && !@shutdown_pipe_r.closed? - @shutdown_pipe_r.close - @shutdown_pipe_r = nil - end - if @shutdown_pipe_w && !@shutdown_pipe_w.closed? - @shutdown_pipe_w.close - @shutdown_pipe_w = nil - end + @shutdown_pipe_w.close + @shutdown_pipe_r.close end private :close_shutdown_pipe @@ -1001,7 +995,7 @@ module DRb https://github.com/ruby/ruby/blob/trunk/lib/drb/drb.rb#L995 # Graceful shutdown def shutdown - @shutdown_pipe_w.close if @shutdown_pipe_w && !@shutdown_pipe_w.closed? + @shutdown_pipe_w.close end # Check to see if this connection is alive. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/