Skip to content

Non-blocking variants of IpcReceiverSet::select#435

Merged
jdm merged 4 commits intoservo:mainfrom
glyn:434-non-blocking-select
Jan 17, 2026
Merged

Non-blocking variants of IpcReceiverSet::select#435
jdm merged 4 commits intoservo:mainfrom
glyn:434-non-blocking-select

Conversation

@glyn
Copy link
Copy Markdown
Contributor

@glyn glyn commented Jan 9, 2026

This PR implements non-blocking variants of IpcReceiverSet::select for unix variants, macOS, Windows, and in-process.

Ref: #434

@glyn glyn force-pushed the 434-non-blocking-select branch 2 times, most recently from 40010b1 to 45c4d95 Compare January 10, 2026 12:12
@glyn glyn changed the title Windows help wanted: Non-blocking variants of IpcReceiverSet::select Non-blocking variants of IpcReceiverSet::select Jan 10, 2026
@glyn glyn force-pushed the 434-non-blocking-select branch 4 times, most recently from 817affb to 97fd9e7 Compare January 16, 2026 10:42
glyn added 3 commits January 16, 2026 14:40
This includes unix, macOS, Windows, and in-process.

For unix platform, see
https://github.com/tokio-rs/mio/issues/1835for
the justification of using a zero duration as a
way of implementing a non-blocking poll.

Ref: servo#434
@glyn glyn force-pushed the 434-non-blocking-select branch from 1f578bc to cf9e843 Compare January 16, 2026 14:50
@glyn glyn marked this pull request as ready for review January 16, 2026 15:20
Copy link
Copy Markdown
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Comment thread src/platform/inprocess/mod.rs Outdated
) -> Result<Vec<OsIpcSelectionResult>, OsTrySelectError> {
if self.receivers.is_empty() {
std::thread::sleep(duration);
if self.receivers.is_empty() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be true, since this method is &mut self and receivers doesn't have any interior mutability.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Fixed in d8a6532.

Comment thread src/platform/windows/mod.rs Outdated
) -> Result<Vec<OsIpcSelectionResult>, OsTrySelectError> {
if self.readers.len() + self.closed_readers.len() == 0 {
thread::sleep(Duration::from_millis(wait as u64));
if self.readers.len() + self.closed_readers.len() == 0 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also true for the same reasons as the in-process backend.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Fixed in d8a6532.

@jdm jdm enabled auto-merge January 17, 2026 07:51
@jdm jdm added this pull request to the merge queue Jan 17, 2026
Merged via the queue into servo:main with commit f823d68 Jan 17, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants