Skip to content

Commit

Permalink
Async patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Cassy343 committed Jul 8, 2022
1 parent e29fe32 commit 3751325
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ extern crate alloc;
use core::{mem::{self, MaybeUninit}, ptr::{self, NonNull}, marker::PhantomData};

#[cfg(not(loom))]
use core::{cell::UnsafeCell, sync::atomic::{fence, AtomicU8, Ordering::*}};
use core::{cell::UnsafeCell, hint, sync::atomic::{fence, AtomicU8, Ordering::*}};
#[cfg(loom)]
use loom::{cell::UnsafeCell, sync::atomic::{fence, AtomicU8, Ordering::*}};
use loom::{cell::UnsafeCell, hint, sync::atomic::{fence, AtomicU8, Ordering::*}};

#[cfg(feature = "async")]
use core::{
Expand Down Expand Up @@ -824,6 +824,11 @@ impl<T> core::future::Future for Receiver<T> {
// The sender was dropped before sending anything while we prepared to park.
// The sender has taken the waker already.
Err(DISCONNECTED) => Poll::Ready(Err(RecvError)),
Err(UNPARKING) => {
cx.waker().wake_by_ref();
hint::spin_loop();
Poll::Pending
},
_ => unreachable!(),
}
}
Expand Down

0 comments on commit 3751325

Please sign in to comment.