Check the boundary condition correctly.
This commit is contained in:
parent
ab85ab7a5b
commit
03f4204297
|
@ -51,7 +51,7 @@ impl AsyncTaskSemaphore {
|
|||
fn acquire(&self) -> MutexGuard<u64> {
|
||||
let mut count = self.counter.lock().unwrap();
|
||||
*count += 1;
|
||||
while *count >= self.permits {
|
||||
while *count > self.permits {
|
||||
count = self.cond_var.wait(count).unwrap();
|
||||
}
|
||||
count
|
||||
|
|
Loading…
Reference in New Issue