Mark mutex in userdata handler as static
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Signed-off-by: Deukhoofd <deukhoofd@gmail.com>
This commit is contained in:
parent
fd83b6b992
commit
09e30a234c
|
@ -3,4 +3,5 @@
|
||||||
|
|
||||||
namespace Porygon::UserData {
|
namespace Porygon::UserData {
|
||||||
UserDataStorage::_internalDataStorage UserDataStorage::_internal = UserDataStorage::_internalDataStorage();
|
UserDataStorage::_internalDataStorage UserDataStorage::_internal = UserDataStorage::_internalDataStorage();
|
||||||
|
std::mutex UserDataStorage::_internalDataStorage::_userDataMutex = std::mutex();
|
||||||
}
|
}
|
|
@ -11,10 +11,9 @@ namespace Porygon::UserData {
|
||||||
class _internalDataStorage {
|
class _internalDataStorage {
|
||||||
public:
|
public:
|
||||||
std::unordered_map<uint32_t, UserData*> _userData;
|
std::unordered_map<uint32_t, UserData*> _userData;
|
||||||
std::mutex _userDataMutex;
|
static std::mutex _userDataMutex;
|
||||||
|
|
||||||
~_internalDataStorage(){
|
~_internalDataStorage(){
|
||||||
std::lock_guard<std::mutex> guard(_userDataMutex);
|
|
||||||
for (auto u: _userData){
|
for (auto u: _userData){
|
||||||
delete u.second;
|
delete u.second;
|
||||||
}
|
}
|
||||||
|
@ -26,12 +25,12 @@ namespace Porygon::UserData {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void RegisterType(uint32_t i, UserData *ud) {
|
static void RegisterType(uint32_t i, UserData *ud) {
|
||||||
std::lock_guard<std::mutex> guard(_internal._userDataMutex);
|
std::lock_guard<std::mutex> guard(_internalDataStorage::_userDataMutex);
|
||||||
UserDataStorage::_internal._userData.insert({i, ud});
|
UserDataStorage::_internal._userData.insert({i, ud});
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClearTypes(){
|
static void ClearTypes(){
|
||||||
std::lock_guard<std::mutex> guard(_internal._userDataMutex);
|
std::lock_guard<std::mutex> guard(_internalDataStorage::_userDataMutex);
|
||||||
for (auto u: _internal._userData){
|
for (auto u: _internal._userData){
|
||||||
delete u.second;
|
delete u.second;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue