Skip to content
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

Associate sockets with a Selector #309

Merged
merged 1 commit into from
Dec 1, 2015

Conversation

carllerche
Copy link
Member

Closes #308

Windows requires that sockets are used exclusively with a single IOCP handle.
Unix platforms do not have this requirement. In order to provide a cross
platform API, Mio's network types artificially impose this limitations on Unix
platforms.

If a user of Mio would like to use a single socket with multiple event loops
on Unix platforms, this is possible by using std::net types and the
EventedFd wrapper.

/cc @alexcrichton

Closes #308

Windows requires that sockets are used exclusively with a single IOCP handle.
Unix platforms do not have this requirement. In order to provide a cross
platform API, Mio's network types artificially impose this limitations on Unix
platforms.

If a user of Mio would like to use a single socket with multiple event loops
on Unix platforms, this is possible by using `std::net` types and the
`EventedFd` wrapper.
@carllerche carllerche added this to the v0.5.0 milestone Nov 26, 2015
@@ -14,11 +15,13 @@ use sys::unix::eventedfd::EventedFd;
#[derive(Debug)]
pub struct TcpStream {
inner: net::TcpStream,
selector_id: Cell<Option<usize>>,
Copy link
Contributor

Choose a reason for hiding this comment

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

This has the consequence of making the types not Sync, which perhaps isn't desired? Concurrently reading/writing with a TcpStream may be useful in some cases.

@alexcrichton
Copy link
Contributor

lgtm

@carllerche carllerche merged commit 010445b into master Dec 1, 2015
@carllerche carllerche deleted the associate-socks-with-selector branch December 4, 2015 04:14
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