diff --git a/src/worker.rs b/src/worker.rs index dfdf8b0..4f978b6 100644 --- a/src/worker.rs +++ b/src/worker.rs @@ -53,4 +53,12 @@ fn main() { // Sleep to allow worker thread to finish processing thread::sleep(std::time::Duration::from_secs(2)); -} \ No newline at end of file + + // Send another task, which will spawn a new worker + let new_worker = Worker::new(2, Arc::clone(&receiver)); + new_worker.start(); + sender.send("New Task".to_string()).unwrap(); + + // Sleep to allow the new worker thread to process the task + thread::sleep(std::time::Duration::from_secs(2)); +}