From: akr@... Date: 2015-06-25T02:29:37+00:00 Subject: [ruby-core:69733] [Ruby trunk - Feature #11139] [PATCH] socket: accept_nonblock supports "nonblock: false" kwarg Issue #11139 has been updated by Akira Tanaka. The default behavior of accept4() is fine. Although most Ruby-level API is nonblocking flag insensitive, there is nonblocking flag sensitive API such as IO#syswrite. Also, the flag affects other (non-Ruby) programs when the FD is inherited to them. Especially stdio doesn't work well on FD with nonblocking flag. I think setting or clearing nonblocking flag after accept() reduces unexpected behaviors. ---------------------------------------- Feature #11139: [PATCH] socket: accept_nonblock supports "nonblock: false" kwarg https://bugs.ruby-lang.org/issues/11139#change-53115 * Author: Eric Wong * Status: Feedback * Priority: Normal * Assignee: Akira Tanaka ---------------------------------------- [PATCH 2/2] socket: accept_nonblock supports "nonblock: false" kwarg An application wanting to do non-blocking accept may want to create a blocking accepted socket, allow it with a kwarg while preserving default behavior. If this patch is accepted, I'd also like to support the opposite for blocking accept calls: a = s.accept(nonblock: true) # blocking accept syscall a.nonblock? # => true s.nonblock? # => false This requires the simple patch in [Feature #11138] I'm unsure if ":nonblock" is a good keyword to use, since it is somewhat confusing ---Files-------------------------------- 0002-socket-accept_nonblock-supports-nonblock-false-kwarg.patch (2.94 KB) -- https://bugs.ruby-lang.org/