changed Server_Room::gamesMutex to QReadWriteLock

This commit is contained in:
Max-Wilhelm Bruker
2013-02-11 15:43:31 +01:00
parent 00029eeeb4
commit 7a30b827c8
7 changed files with 29 additions and 29 deletions

View File

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