Feature #11139

Updated by normalperson (Eric Wong) over 4 years ago

[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

This If this patch is analogous accepted, I'd also like to support the SOCK_NONBLOCK flag in the Linux `accept4' opposite

While this has little obvious effect
for Ruby API users (which
can emulate
blocking behavior) this will reduce syscalls made
internally by Ruby. Forcing
accept calls:

a = s.accept(nonblock: true) #
blocking will preserve "wake-one"
accept syscall
a.nonblock? # => true
s.nonblock? # => false

This requires the simple patch
in the OS kernel to avoid a "thundering herd" problem. [Feature #11138]

In all cases, existing Ruby 2.2 behavior I'm unsure if ":nonblock" is preserved by default
a good keyword to maximize compatibility, especially when sharing sockets with use, since it is
non-Ruby processes:

`accept' and `sysaccept' calls will create sockets which are
blocking by default.

`accept_nonblock', calls will create sockets which are non-blocking
by default.
somewhat confusing