Skip to content

Commit

Permalink
Simplify task LocalWaker register method (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
zzau13 authored Nov 29, 2020
1 parent d1f8ac1 commit f09c9e4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions ntex/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ impl LocalWaker {
///
/// Returns `true` if waker was registered before.
pub fn register(&self, waker: &Waker) -> bool {
unsafe {
let w = self.waker.get();
let is_registered = (*w).is_some();
*w = Some(waker.clone());
is_registered
}
unsafe { self.waker.get().replace(Some(waker.clone())).is_some() }
}

#[inline]
Expand Down

0 comments on commit f09c9e4

Please sign in to comment.