Skip to content

Commit b291184

Browse files
authored
Merge pull request #189 from honzuki/deadlock_hazard
Fix potential deadlock in the executor
2 parents c54cc31 + d690d23 commit b291184

File tree

1 file changed

+2
-2
lines changed
  • examples/02_04_executor/src

1 file changed

+2
-2
lines changed

examples/02_04_executor/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl Spawner {
6161
future: Mutex::new(Some(future)),
6262
task_sender: self.task_sender.clone(),
6363
});
64-
self.task_sender.send(task).expect("too many tasks queued");
64+
self.task_sender.try_send(task).expect("too many tasks queued");
6565
}
6666
}
6767
// ANCHOR_END: spawn_fn
@@ -74,7 +74,7 @@ impl ArcWake for Task {
7474
let cloned = arc_self.clone();
7575
arc_self
7676
.task_sender
77-
.send(cloned)
77+
.try_send(cloned)
7878
.expect("too many tasks queued");
7979
}
8080
}

0 commit comments

Comments
 (0)