Commit d7424758b5
Unsigned
Layout: unified · split
src/executor.rs +9 −3
| @@ -76,11 +76,17 @@ where | ||
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | 78 | let schedule = move |task| { |
| 79 | let mut weechat_notify = weechat_notify.lock().unwrap(); | |
| 80 | let mut queue = queue.lock().unwrap(); | |
| 79 | let mut weechat_notify = weechat_notify | |
| 80 | .lock() | |
| 81 | .expect("Weechat notification sender lock is poisoned"); | |
| 82 | let mut queue = queue.lock().expect( | |
| 83 | "Lock of the future queue of the Weechat executor is poisoned", | |
| 84 | ); | |
| 81 | 85 | |
| 82 | 86 | queue.push_back(task); |
| 83 | weechat_notify.send(()).unwrap(); | |
| 87 | weechat_notify | |
| 88 | .send(()) | |
| 89 | .expect("Can't notify Weechat to run a future"); | |
| 84 | 90 | }; |
| 85 | 91 | |
| 86 | 92 | let (task, handle) = async_task::spawn(future, schedule, ()); |