aboutsummaryrefslogtreecommitdiff
path: root/crates/thread_worker
diff options
context:
space:
mode:
Diffstat (limited to 'crates/thread_worker')
-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();