in crates/libs/core/src/sync/channel.rs [56:71]
fn cancel_inner_ctx(&mut self) -> crate::WinResult<()> {
if let Some(ctx) = &self.ctx {
if let Err(e) = unsafe { ctx.Cancel() } {
// fail to cancel inner operation.
return Err(e);
} else {
// clear the sf ctx to avoid cancel twice.
self.ctx.take();
}
} else {
// The inner ctx can be empty after we already cancelled the inner ctx.
// This can happen because we cancel during polling, and polling can
// happen many times.
}
Ok(())
}