mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 13:10:54 +00:00
Avoid panic when spawn is called after run exits in deterministic executor
This commit is contained in:
parent
9bfa5b62f2
commit
2965fce70d
1 changed files with 6 additions and 2 deletions
|
@ -51,7 +51,9 @@ impl Deterministic {
|
|||
let (runnable, task) = async_task::spawn_local(future, move |runnable| {
|
||||
let mut runnables = runnables.lock();
|
||||
runnables.0.push(runnable);
|
||||
runnables.1.as_ref().unwrap().send(()).ok();
|
||||
if let Some(wake_tx) = runnables.1.as_ref() {
|
||||
wake_tx.send(()).ok();
|
||||
}
|
||||
});
|
||||
runnable.schedule();
|
||||
task
|
||||
|
@ -66,7 +68,9 @@ impl Deterministic {
|
|||
let (runnable, task) = async_task::spawn(future, move |runnable| {
|
||||
let mut runnables = runnables.lock();
|
||||
runnables.0.push(runnable);
|
||||
runnables.1.as_ref().unwrap().send(()).ok();
|
||||
if let Some(wake_tx) = runnables.1.as_ref() {
|
||||
wake_tx.send(()).ok();
|
||||
}
|
||||
});
|
||||
runnable.schedule();
|
||||
task
|
||||
|
|
Loading…
Reference in a new issue