feat(Core/Threading): replace ace threading (#4821)

This commit is contained in:
Kargatum 2021-04-17 00:45:29 +07:00 committed by GitHub
parent b9e84d8278
commit b2861be1cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 300 additions and 342 deletions

View file

@ -13,15 +13,15 @@ public:
static uint32 GetSavingCurrentValue() { return m_savingCurrentValue; } // modified only during single thread
static uint32 GetSavingMaxValue() { return m_savingMaxValueAssigned; } // modified only during single thread
static void IncreaseSavingCurrentValue(uint32 inc) { m_savingCurrentValue += inc; } // used and modified only during single thread
static uint32 IncreaseSavingMaxValue(uint32 inc) { ACORE_GUARD(ACE_Thread_Mutex, _savingLock); return (m_savingMaxValueAssigned += inc); }
static void InsertToSavingSkipListIfNeeded(uint32 id) { if (id > m_savingCurrentValue) { ACORE_GUARD(ACE_Thread_Mutex, _savingLock); m_savingSkipList.push_back(id); } }
static uint32 IncreaseSavingMaxValue(uint32 inc) { std::lock_guard<std::mutex> guard(_savingLock); return (m_savingMaxValueAssigned += inc); }
static void InsertToSavingSkipListIfNeeded(uint32 id) { if (id > m_savingCurrentValue) { std::lock_guard<std::mutex> guard(_savingLock); m_savingSkipList.push_back(id); } }
protected:
static uint32 m_savingCurrentValue;
static uint32 m_savingMaxValueAssigned;
static uint32 m_savingDiffSum;
static std::list<uint32> m_savingSkipList;
static ACE_Thread_Mutex _savingLock;
static std::mutex _savingLock;
};
#endif