From e97786659f446c56b3120e2f25df6f47b761504a Mon Sep 17 00:00:00 2001 From: jcbritobr Date: Wed, 3 May 2023 21:59:25 -0300 Subject: [PATCH] Enhance README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 90ed932..aa84657 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,12 @@ fn main() { let pool = pool::WorkerPool::new(nworkers); let (tx, rx) = mpsc::channel(); + let atx = Arc::new(Mutex::new(tx)); for _ in 0..njobs { - let tx = tx.clone(); + let atx = atx.clone(); pool.execute(Box::new(move || { + let tx = atx.lock().unwrap(); tx.send(1).expect("channel waiting for pool"); })); }