Comments (1)
Some time ago I remember seeing a notice along the lines of "Streams registered to a Poll on one thread can only be read on the same thread," or "Streams which Events were received on one thread must be read on the same thread." I don't remember the exact wording or the version of mio, but I can't find such a line in current docs. Does that mean that it is now possible to create connections, register for events, poll events and read streams on different threads?
I don't know where you saw this, but both statements are inaccurate.
For example: Thread 1: creates a TcpStream Thread 2: creates a Poll, registers and and polls events Thread 3: reads from and writes to the TcpStream after a readiness event is received.
Would that configuration work or am I missing something?
TcpStream
, like all other types exposed by Mio, are usable from any thread. Some methods need mutable, e.g. Poll::poll
, but then we use &mut self
instead of &self
. If the type is Send
and the method takes an immutable reference (i.e. &self
) it's safe to use across threads.
Btw the above goes for any Rust code, otherwise it would be unsound.
from mio.
Related Issues (20)
- Windows named pipes hits unreachable code during read operation HOT 1
- Exposing `AsRawHandle` on `Registry` HOT 5
- build failed with wasm-pack HOT 1
- Wait for messages in the error queue HOT 6
- Setup WASM/WASI CI
- get any errors when i use `wasm-pack` command by `mio` HOT 4
- Need switch to not use eventfd on `target_os = "linux"` HOT 4
- Add ESP-IDF framework support
- IoRing support for windows HOT 3
- Has waker check doesn't work with try_cloned Registries HOT 1
- compile time error inside `poll.rs` HOT 3
- poll: Optimize locks and allocations in the critical path
- Poll(2) implementation follow-ups
- Official ESP-IDF framework support HOT 3
- Make `CompletionPort` public? HOT 7
- No data coming from Poll HOT 8
- Difference behaves between Linux and Windows HOT 2
- How to wait for a socket to be writable? udp / Interest::READABLE | Interest::WRITABLE HOT 6
- could not compile mio due to 44 previous errors HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mio.