Skip to content

Instantly share code, notes, and snippets.

@cedelmaier
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cedelmaier/9e77a24e6e95cfaee597 to your computer and use it in GitHub Desktop.
Save cedelmaier/9e77a24e6e95cfaee597 to your computer and use it in GitHub Desktop.
Attempt at using oyashio
extern crate oyashio;
use oyashio::{Stream};
use std::thread;
fn main() {
let (mut st, mut sr) = Stream::new();
let input = vec!["The",
"quick",
"brown",
"fox",
"jumped",
"over",
"the",
"lazy",
"dog."];
// Send the lines
for line in input {
st.send(line);
}
for i in 0..3 {
let src = sr.clone();
thread::spawn(move || {
for n in src.poll() {
println!("Thread: {}, \n\t{}", i, n);
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment