Project

General

Profile

Actions

Feature #11139

open

[PATCH] socket: support accept `sock_nonblock: (true|false)'

Added by normalperson (Eric Wong) over 6 years ago. Updated over 6 years ago.

Status:
Feedback
Priority:
Normal
Target version:
-
[ruby-core:69131]

Description

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.

This is analogous to the SOCK_NONBLOCK flag in the Linux `accept4'
syscall.

While this has little obvious effect for Ruby API users (which
can emulate blocking behavior) this will reduce syscalls made
internally by Ruby. Forcing blocking will preserve "wake-one"
behavior in the OS kernel to avoid a "thundering herd" problem.

In all cases, existing Ruby 2.2 behavior is preserved by default
to maximize compatibility, especially when sharing sockets with
non-Ruby processes:

accept' andsysaccept' calls will create sockets which are
blocking by default.

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


Files

Actions

Also available in: Atom PDF