diff --git a/src/worker.rs b/src/worker.rs index 6ba37d8..34bdb7d 100644 --- a/src/worker.rs +++ b/src/worker.rs @@ -8,7 +8,6 @@ use parking_lot::Mutex; struct Worker { sender: mpsc::Sender, - receiver: Arc>>, value:Arc>, } @@ -17,14 +16,12 @@ impl Worker { let (sender, receiver) = mpsc::channel::(); let ret=Self { sender, - receiver:Arc::new(Mutex::new(receiver)), value:Arc::new(Mutex::new(value)), }; - let receiver=ret.receiver.clone(); let value=ret.value.clone(); thread::spawn(move || { loop { - match receiver.lock().recv() { + match receiver.recv() { Ok(task) => { println!("Worker got a task"); // Process the task