Check the boundary condition correctly.

This commit is contained in:
Lijun Wang 2022-10-19 12:22:20 -07:00
parent ab85ab7a5b
commit 03f4204297
1 changed files with 1 additions and 1 deletions

View File

@ -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