Explorar o código

Merge pull request #881 from Demonthos/fix-waking-on-shutdown

Fix panic when waking future on shutdown
Jon Kelley %!s(int64=2) %!d(string=hai) anos
pai
achega
07fc95954e
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      packages/core/src/scheduler/task.rs

+ 3 - 3
packages/core/src/scheduler/task.rs

@@ -72,9 +72,9 @@ pub struct LocalTaskHandle {
 
 impl ArcWake for LocalTaskHandle {
     fn wake_by_ref(arc_self: &Arc<Self>) {
-        arc_self
+        // This can fail if the scheduler has been dropped while the application is shutting down
+        let _ = arc_self
             .tx
-            .unbounded_send(SchedulerMsg::TaskNotified(arc_self.id))
-            .unwrap();
+            .unbounded_send(SchedulerMsg::TaskNotified(arc_self.id));
     }
 }