summaryrefslogtreecommitdiff
path: root/lib/webrick/server.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-10 03:20:06 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-10 03:20:06 +0000
commite62fe866e562ff267b353150c39b084771c34590 (patch)
tree51d2f5d6c6a992c999f1cbd1e2e4513cc5062182 /lib/webrick/server.rb
parent2a9ea113550c8358788dd1a3f163aba963b28d96 (diff)
* 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
Diffstat (limited to 'lib/webrick/server.rb')
-rw-r--r--lib/webrick/server.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb
index dd1be6a..9b83c84 100644
--- a/lib/webrick/server.rb
+++ b/lib/webrick/server.rb
@@ -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