mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
changed Server_Room::gamesMutex to QReadWriteLock
This commit is contained in:
parent
00029eeeb4
commit
7a30b827c8
7 changed files with 29 additions and 29 deletions
|
|
@ -273,7 +273,7 @@ void Server::externalUserLeft(const QString &userName)
|
|||
if (!room)
|
||||
continue;
|
||||
|
||||
QMutexLocker roomGamesLocker(&room->gamesMutex);
|
||||
QReadLocker roomGamesLocker(&room->gamesLock);
|
||||
Server_Game *game = room->getGames().value(userGamesIterator.key());
|
||||
if (!game)
|
||||
continue;
|
||||
|
|
@ -399,7 +399,7 @@ void Server::externalGameCommandContainerReceived(const CommandContainer &cont,
|
|||
throw Response::RespNotInRoom;
|
||||
}
|
||||
|
||||
QMutexLocker roomGamesLocker(&room->gamesMutex);
|
||||
QReadLocker roomGamesLocker(&room->gamesLock);
|
||||
Server_Game *game = room->getGames().value(cont.game_id());
|
||||
if (!game) {
|
||||
qDebug() << "externalGameCommandContainerReceived: game id=" << cont.game_id() << "not found";
|
||||
|
|
@ -509,7 +509,7 @@ int Server::getGamesCount() const
|
|||
QMapIterator<int, Server_Room *> roomIterator(rooms);
|
||||
while (roomIterator.hasNext()) {
|
||||
Server_Room *room = roomIterator.next().value();
|
||||
QMutexLocker roomLocker(&room->gamesMutex);
|
||||
QReadLocker roomLocker(&room->gamesLock);
|
||||
result += room->getGames().size();
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue