mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
refactor: fixed potential game freeze in some infinite cycles, disconnects and top library's card usage (related to #11285);
This commit is contained in:
parent
cfad27ffae
commit
b51fdae550
11 changed files with 45 additions and 50 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue