Fixed - AsyncSemaphore race condition issue. 3703

pull/3744/head
Nikita Koksharov 4 years ago
parent 3f51e5f24f
commit 34d2e4de3a

@ -60,11 +60,6 @@ public class AsyncSemaphore {
} }
private void tryRun() { private void tryRun() {
if (counter.get() == 0
|| listeners.peek() == null) {
return;
}
if (counter.decrementAndGet() >= 0) { if (counter.decrementAndGet() >= 0) {
Runnable listener = listeners.poll(); Runnable listener = listeners.poll();
if (listener == null) { if (listener == null) {
@ -74,7 +69,9 @@ public class AsyncSemaphore {
listener.run(); listener.run();
} else { } else {
counter.incrementAndGet(); if (counter.incrementAndGet() > 0) {
tryRun();
}
} }
} }

Loading…
Cancel
Save