mirror of
https://github.com/async-rs/async-std.git
synced 2025-04-01 22:16:40 +00:00
rafactor if expression
This commit is contained in:
parent
f08fcd0bbb
commit
c31861aa65
1 changed files with 2 additions and 2 deletions
|
@ -30,7 +30,7 @@ impl Sleepers {
|
|||
pub fn wait(&self) {
|
||||
let mut sleep = self.sleep.lock().unwrap();
|
||||
|
||||
if self.notified.swap(false, Ordering::SeqCst) == false {
|
||||
if !self.notified.swap(false, Ordering::SeqCst){
|
||||
*sleep += 1;
|
||||
let _ = self.wake.wait(sleep).unwrap();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ impl Sleepers {
|
|||
|
||||
/// Notifies one thread.
|
||||
pub fn notify_one(&self) {
|
||||
if self.notified.load(Ordering::SeqCst) == false {
|
||||
if !self.notified.load(Ordering::SeqCst) {
|
||||
let mut sleep = self.sleep.lock().unwrap();
|
||||
|
||||
if *sleep > 0 {
|
||||
|
|
Loading…
Reference in a new issue