diff options
Diffstat (limited to 'common/uintmap.h')
-rw-r--r-- | common/uintmap.h | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/common/uintmap.h b/common/uintmap.h deleted file mode 100644 index 0646d2b5..00000000 --- a/common/uintmap.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef AL_UINTMAP_H -#define AL_UINTMAP_H - -#include <unordered_map> -#include <mutex> - -#include "AL/al.h" - -template<typename T0, typename T1> -class ThrSafeMap { - std::unordered_map<T0, T1> mValues; - std::mutex mLock; - -public: - void InsertEntry(T0 key, T1 value) noexcept - { - std::lock_guard<std::mutex> _{mLock}; - mValues[key] = value; - } - - T1 RemoveKey(T0 key) noexcept - { - T1 retval{}; - - std::lock_guard<std::mutex> _{mLock}; - auto iter = mValues.find(key); - if(iter != mValues.end()) - retval = iter->second; - mValues.erase(iter); - - return retval; - } -}; - -#endif /* AL_UINTMAP_H */ |