gpt: unconditionally spawn new worker

This commit is contained in:
Quaternions 2023-10-04 01:34:24 -07:00
parent e547940f2b
commit f3f624c44c

View File

@ -53,4 +53,12 @@ fn main() {
// Sleep to allow worker thread to finish processing // Sleep to allow worker thread to finish processing
thread::sleep(std::time::Duration::from_secs(2)); thread::sleep(std::time::Duration::from_secs(2));
// 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));
} }