We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ff47cb3 commit 40ef717Copy full SHA for 40ef717
1 file changed
compio-runtime/src/runtime/scheduler/mod.rs
@@ -117,12 +117,13 @@ impl WeakTaskQueue {
117
#[cfg(feature = "notify-always")]
118
notify.notify().ok();
119
}
120
- } else {
121
- // We have to panic if the queue has been dropped, because we cannot drop the
122
- // runnable safely on another thread.
123
- let sync_queue = self.sync_queue.upgrade().unwrap();
+ } else if let Some(sync_queue) = self.sync_queue.upgrade() {
124
sync_queue.push(runnable);
125
+ } else {
+ // We have to leak the runnable since it's not safe to drop it on another
+ // thread.
126
+ std::mem::forget(runnable);
127
128
129
0 commit comments