mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/webrick/server.rb (shutdown): Use close() on @shutdown_pipe_w to
notify readability on the read side of the pipe. write_nonblock() is not usable for pipe on Windows. (cleanup_shutdown_pipe): Rescue IOError for @shutdown_pipe_w.close. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2a9ea11355
commit
e62fe866e5
2 changed files with 13 additions and 4 deletions
|
@ -1,3 +1,10 @@
|
|||
Mon Nov 10 12:19:43 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/webrick/server.rb (shutdown): Use close() on @shutdown_pipe_w to
|
||||
notify readability on the read side of the pipe.
|
||||
write_nonblock() is not usable for pipe on Windows.
|
||||
(cleanup_shutdown_pipe): Rescue IOError for @shutdown_pipe_w.close.
|
||||
|
||||
Mon Nov 10 07:31:59 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/webrick/server.rb (initialize): Initialize shutdown pipe here
|
||||
|
|
|
@ -226,10 +226,9 @@ module WEBrick
|
|||
stop
|
||||
|
||||
shutdown_pipe_w = @shutdown_pipe_w # another thread may modify @shutdown_pipe_w.
|
||||
if shutdown_pipe_w
|
||||
if shutdown_pipe_w && !shutdown_pipe_w.closed?
|
||||
begin
|
||||
shutdown_pipe_w.write_nonblock "a"
|
||||
rescue IO::WaitWritable
|
||||
shutdown_pipe_w.close
|
||||
rescue IOError # closed by another thread.
|
||||
end
|
||||
end
|
||||
|
@ -320,7 +319,10 @@ module WEBrick
|
|||
|
||||
def cleanup_shutdown_pipe
|
||||
@shutdown_pipe_r.close
|
||||
@shutdown_pipe_w.close
|
||||
begin
|
||||
@shutdown_pipe_w.close
|
||||
rescue IOError # another thread closed @shutdown_pipe_w.
|
||||
end
|
||||
@shutdown_pipe_r = @shutdown_pipe_w = nil
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue