High throughput synchronous queue and channels. The implementation of the queue is freely inspired by the LMAX Disruptor. As in a typical disruptor fashion, consumers see all items pushed onto the queue. The implementation is then better suited for dispatching all items to all consumers.
Therefore, the queue provided here do not allow sending the ownership of queued items onto other threads.
Instead, receivers (consumers) will only see immutable references to the items.
When items can be copied (implements Copy), copies can be obtained instead.
Example
Create a queue with a single producer and 5 event consumers.
use Arc;
use TryRecvError;
use ;
let ring = new;
let mut consumers =
.map
.;
let mut producer = new;
let consumer_threads =
.map
.;
for item in 0..1000
drop; // so that `TryRecvError::Disconnected` is raised
for consumer in consumer_threads
no-std support
onering is compatible with no-std context, having a std feature which is activated by default.
To use onering without the std, deactivate the default features in your Cargo.toml file.
Contributing
Contributions are welcome!
Open a ticket, ask a question or submit a pull request.
License
This project is licensed under the MIT license.