Allow non-mut register and wake

This commit is contained in:
Ulf Lilleengen 2021-06-01 14:35:52 +02:00
parent 553432a8e8
commit ec9b51833c

View File

@ -61,7 +61,7 @@ impl AtomicWaker {
} }
/// Register a waker. Overwrites the previous waker, if any. /// Register a waker. Overwrites the previous waker, if any.
pub fn register(&mut self, w: &Waker) { pub fn register(&self, w: &Waker) {
critical_section::with(|cs| { critical_section::with(|cs| {
let cell = self.waker.borrow(cs); let cell = self.waker.borrow(cs);
cell.set(match cell.replace(None) { cell.set(match cell.replace(None) {
@ -72,7 +72,7 @@ impl AtomicWaker {
} }
/// Wake the registered waker, if any. /// Wake the registered waker, if any.
pub fn wake(&mut self) { pub fn wake(&self) {
critical_section::with(|cs| { critical_section::with(|cs| {
let cell = self.waker.borrow(cs); let cell = self.waker.borrow(cs);
if let Some(w) = cell.replace(None) { if let Some(w) = cell.replace(None) {