refactor: fixed potential game freeze in some infinite cycles, disconnects and top library's card usage (related to #11285);

This commit is contained in:
Oleg Agafonov 2024-10-24 13:19:05 +04:00
parent cfad27ffae
commit b51fdae550
11 changed files with 45 additions and 50 deletions

View file

@ -149,45 +149,27 @@ public enum ServerMessagesUtil {
}
public void incGamesStarted() {
int value;
do {
value = gamesStarted.get();
} while (!gamesStarted.compareAndSet(value, value + 1));
gamesStarted.incrementAndGet();
}
public void incGamesEnded() {
int value;
do {
value = gamesEnded.get();
} while (!gamesEnded.compareAndSet(value, value + 1));
gamesEnded.incrementAndGet();
}
public void incTournamentsStarted() {
int value;
do {
value = tournamentsStarted.get();
} while (!tournamentsStarted.compareAndSet(value, value + 1));
tournamentsStarted.incrementAndGet();
}
public void incTournamentsEnded() {
int value;
do {
value = tournamentsEnded.get();
} while (!tournamentsEnded.compareAndSet(value, value + 1));
tournamentsEnded.incrementAndGet();
}
public void incReconnects() {
int value;
do {
value = reconnects.get();
} while (!reconnects.compareAndSet(value, value + 1));
reconnects.incrementAndGet();
}
public void incLostConnection() {
int value;
do {
value = lostConnection.get();
} while (!lostConnection.compareAndSet(value, value + 1));
lostConnection.incrementAndGet();
}
}