#include "core/CNShared.hpp" #if defined(__MINGW32__) && !defined(_GLIBCXX_HAS_GTHREADS) #include "mingw/mingw.mutex.h" #else #include #endif std::map CNShared::players; std::mutex playerCrit; void CNShared::setPlayer(int64_t sk, Player& plr) { std::lock_guard lock(playerCrit); // the lock will be removed when the function ends players[sk] = plr; } Player CNShared::getPlayer(int64_t sk) { std::lock_guard lock(playerCrit); // the lock will be removed when the function ends return players[sk]; } void CNShared::erasePlayer(int64_t sk) { std::lock_guard lock(playerCrit); // the lock will be removed when the function ends players.erase(sk); }