diff options
author | Aleksey Kladov <[email protected]> | 2018-12-30 20:23:31 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-12-30 20:23:31 +0000 |
commit | c2c10b9014549e9c0783fb13dc202dfab6e6fd0a (patch) | |
tree | d4b2a47910df5effb14271ab72a1602b5f77ee81 /crates/thread_worker | |
parent | effc1eae8be338ea949058cc89c39950c25858c5 (diff) |
:arrow_up: crossbeam
closes #189
Diffstat (limited to 'crates/thread_worker')
-rw-r--r-- | crates/thread_worker/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/thread_worker/src/lib.rs | 6 |
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] |
8 | drop_bomb = "0.1.0" | 8 | drop_bomb = "0.1.0" |
9 | crossbeam-channel = "0.2.4" | 9 | crossbeam-channel = "0.3.5" |
10 | log = "0.4.3" | 10 | log = "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 | ||
3 | use std::thread; | 3 | use std::thread; |
4 | 4 | ||
5 | use crossbeam_channel::{bounded, unbounded, Receiver, Sender}; | 5 | use crossbeam_channel::{bounded, unbounded, Receiver, Sender, RecvError, SendError}; |
6 | use drop_bomb::DropBomb; | 6 | use drop_bomb::DropBomb; |
7 | 7 | ||
8 | pub struct Worker<I, O> { | 8 | pub 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 | } |