aboutsummaryrefslogtreecommitdiff
path: root/crates/thread_worker/src/lib.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-12-20 09:16:07 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-12-20 09:16:07 +0000
commit9a16cf2bf646a4a881f3f5acbf5582dacc4337bf (patch)
treeff90eb390a8f5af47b6d0c6ec4c49b4431b82d1c /crates/thread_worker/src/lib.rs
parentdbb62b5baa36783bbca06f09c77794fce3ceff0c (diff)
parenta084412f0698d5f54d586f707930e141c88b0673 (diff)
Merge #292
292: Vfs r=matklad a=matklad closes #243 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/thread_worker/src/lib.rs')
-rw-r--r--crates/thread_worker/src/lib.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/thread_worker/src/lib.rs b/crates/thread_worker/src/lib.rs
index e558559ef..12e8bf17e 100644
--- a/crates/thread_worker/src/lib.rs
+++ b/crates/thread_worker/src/lib.rs
@@ -30,13 +30,16 @@ where
30impl<I, O> Worker<I, O> { 30impl<I, O> Worker<I, O> {
31 /// Stops the worker. Returns the message receiver to fetch results which 31 /// Stops the worker. Returns the message receiver to fetch results which
32 /// have become ready before the worker is stopped. 32 /// have become ready before the worker is stopped.
33 pub fn stop(self) -> Receiver<O> { 33 pub fn shutdown(self) -> Receiver<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) {
38 self.inp.send(item) 38 self.inp.send(item)
39 } 39 }
40 pub fn recv(&self) -> Option<O> {
41 self.out.recv()
42 }
40} 43}
41 44
42impl WorkerHandle { 45impl WorkerHandle {
@@ -45,11 +48,11 @@ impl WorkerHandle {
45 WorkerHandle { 48 WorkerHandle {
46 name, 49 name,
47 thread, 50 thread,
48 bomb: DropBomb::new(format!("WorkerHandle {} was not stopped", name)), 51 bomb: DropBomb::new(format!("WorkerHandle {} was not shutdown", name)),
49 } 52 }
50 } 53 }
51 54
52 pub fn stop(mut self) -> thread::Result<()> { 55 pub fn shutdown(mut self) -> thread::Result<()> {
53 log::info!("waiting for {} to finish ...", self.name); 56 log::info!("waiting for {} to finish ...", self.name);
54 let name = self.name; 57 let name = self.name;
55 self.bomb.defuse(); 58 self.bomb.defuse();