Make mutex non-static again
continuous-integration/drone/push Build is failing Details

Signed-off-by: Deukhoofd <deukhoofd@gmail.com>
This commit is contained in:
Deukhoofd 2019-06-24 16:34:09 +02:00
parent ef150f6851
commit e363d55206
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
2 changed files with 3 additions and 4 deletions

View File

@ -3,5 +3,4 @@
namespace Porygon::UserData {
UserDataStorage::_internalDataStorage UserDataStorage::_internal = UserDataStorage::_internalDataStorage();
std::mutex UserDataStorage::_internalDataStorage::_userDataMutex = std::mutex();
}

View File

@ -12,7 +12,7 @@ namespace Porygon::UserData {
class _internalDataStorage {
public:
std::unordered_map<uint32_t, UserData*> _userData;
static std::mutex _userDataMutex;
std::mutex _userDataMutex;
~_internalDataStorage(){
for (auto u: _userData){
@ -31,12 +31,12 @@ namespace Porygon::UserData {
public:
static void RegisterType(uint32_t i, UserData *ud) {
std::lock_guard<std::mutex> guard(_internalDataStorage::_userDataMutex);
std::lock_guard<std::mutex> guard(_internal._userDataMutex);
UserDataStorage::_internal._userData.insert({i, ud});
}
static void ClearTypes(){
std::lock_guard<std::mutex> guard(_internalDataStorage::_userDataMutex);
std::lock_guard<std::mutex> guard(_internal._userDataMutex);
for (auto u: _internal._userData){
delete u.second;
}