ReactIO
Portable Reactor pattern in Rust.
Supported platforms: Linux, Windows
ReactIO is a Rust library that implements event-driven Reactor pattern in single-threaded and multiple-threaded environment.
Each ReactRuntime
instance runs in a dedicated threaded. It polls all events for managed Reactors. There'are 2 kinds of events:
- socket events. We only registers socket READ events, and MsgReader & MsgSender are provided for Reactor to send/receive messages.
- commands. Through mpsc channel, reactors could send user defined commands to each other.
When processing events, Reactor doesn't need any mutex to protect resources.
Examples
Single-threaded ReactRuntime
See example in reactor.rs.
Multi-threaded Reactors - Each thread runs an ReactRuntime
See example in threaded_reactors.rs.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/license/mit/)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.