shared_channel 0.2.0

Multi-producer, multi-consumer FIFO queue communication primitives.
Documentation
  • Coverage
  • 22.22%
    2 out of 9 items documented1 out of 8 items with examples
  • Size
  • Source code size: 19.4 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.57 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • hinohi/rust_shared_channel
    0 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hinohi

shared channel

This is a implementation of multi-producer, multi-consumer channel in Rust.

Example

simple usage

use std::thread;

extern crate shared_channel;
use shared_channel::shared_channel;

fn main() {
    let (tx, rx) = shared_channel();
    for i in 0..10 {
        let rx = rx.clone();
        thread::spawn(move || println!("{}", rx.recv().unwrap()));
    }
    for i in 0..10 {
        tx.send(i).unwrap();
    }
}

Pre-forked web server

git clone https://github.com/hinohi/rust_shared_channel.git
cd rust_shared_channel
cargo run --example hello_server

Please access http://localhost:5000. Its response looks like Hello! I'm No.0. The number shows ID of thread-pool's worker.

TODO

  • implement Reciver's stable API
    • try_recv
    • recv
    • recv_timeout
    • iter
    • try_iter
  • implement shared_sync_channel