aboutsummaryrefslogtreecommitdiff
path: root/crates/thread_worker
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-12-30 20:23:31 +0000
committerAleksey Kladov <[email protected]>2018-12-30 20:23:31 +0000
commitc2c10b9014549e9c0783fb13dc202dfab6e6fd0a (patch)
treed4b2a47910df5effb14271ab72a1602b5f77ee81 /crates/thread_worker
parenteffc1eae8be338ea949058cc89c39950c25858c5 (diff)
:arrow_up: crossbeam
closes #189
Diffstat (limited to 'crates/thread_worker')
-rw-r--r--crates/thread_worker/Cargo.toml2
-rw-r--r--crates/thread_worker/src/lib.rs6
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/thread_worker/Cargo.toml b/crates/thread_worker/Cargo.toml
index 62d66a1a3..c74b376e2 100644
--- a/crates/thread_worker/Cargo.toml
+++ b/crates/thread_worker/Cargo.toml
@@ -6,6 +6,6 @@ authors = ["Aleksey Kladov <[email protected]>"]
6 6
7[dependencies] 7[dependencies]
8drop_bomb = "0.1.0" 8drop_bomb = "0.1.0"
9crossbeam-channel = "0.2.4" 9crossbeam-channel = "0.3.5"
10log = "0.4.3" 10log = "0.4.3"
11 11
diff --git a/crates/thread_worker/src/lib.rs b/crates/thread_worker/src/lib.rs
index 12e8bf17e..5e46f62fe 100644
--- a/crates/thread_worker/src/lib.rs
+++ b/crates/thread_worker/src/lib.rs
@@ -2,7 +2,7 @@
2 2
3use std::thread; 3use std::thread;
4 4
5use crossbeam_channel::{bounded, unbounded, Receiver, Sender}; 5use crossbeam_channel::{bounded, unbounded, Receiver, Sender, RecvError, SendError};
6use drop_bomb::DropBomb; 6use drop_bomb::DropBomb;
7 7
8pub struct Worker<I, O> { 8pub struct Worker<I, O> {
@@ -34,10 +34,10 @@ impl<I, O> Worker<I, O> {
34 self.out 34 self.out
35 } 35 }
36 36
37 pub fn send(&self, item: I) { 37 pub fn send(&self, item: I) -> Result<(), SendError<I>> {
38 self.inp.send(item) 38 self.inp.send(item)
39 } 39 }
40 pub fn recv(&self) -> Option<O> { 40 pub fn recv(&self) -> Result<O, RecvError> {
41 self.out.recv() 41 self.out.recv()
42 } 42 }
43} 43}