-
Notifications
You must be signed in to change notification settings - Fork 274
Add simple interface for busy_poll on Linux #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -381,6 +381,21 @@ impl Socket { | |
| sys::set_nonblocking(self.as_raw(), nonblocking) | ||
| } | ||
|
|
||
| /// Sets the busy polling timeout in microseconds for blocking socket operations. | ||
| /// | ||
| /// When there is no data available, the socket will busy poll for the specified | ||
| /// duration (in microseconds) before falling back to blocking behavior. | ||
| /// | ||
| /// # Notes | ||
| /// | ||
| /// - Requires `CAP_NET_ADMIN` capability to increase the value | ||
| /// - Default value is controlled by `/proc/sys/net/core/busy_read` | ||
| /// - Available since Linux 3.11 | ||
| #[cfg(target_os = "linux")] | ||
|
||
| pub fn set_busy_poll(&self, busy_poll: u16) -> io::Result<()> { | ||
|
||
| sys::set_busy_poll(self.as_raw(), busy_poll) | ||
| } | ||
|
||
|
|
||
| /// Shuts down the read, write, or both halves of this connection. | ||
| /// | ||
| /// This function will cause all pending and future I/O on the specified | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we replace these notes with only calling out
SO_BUSY_POLL, similar to the other functions. I don't want to copy all notes from the man page.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, if it's your wish.