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
50 changed files with 300 additions and 342 deletions

View File

@@ -5815,8 +5815,8 @@ void Player::ClearChannelWatch()
void Player::UpdateLocalChannels(uint32 newZone)
{
// pussywizard: mutex needed (tc changed opcode to THREAD UNSAFE)
static ACE_Thread_Mutex channelsLock;
ACORE_GUARD(ACE_Thread_Mutex, channelsLock);
static std::mutex channelsLock;
std::lock_guard<std::mutex> guard(channelsLock);
if (GetSession()->PlayerLoading() && !IsBeingTeleportedFar())
return; // The client handles it automatically after loading, but not after teleporting
@@ -14361,7 +14361,7 @@ void Player::TradeCancel(bool sendback)
void Player::UpdateSoulboundTradeItems()
{
ACORE_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock);
std::lock_guard<std::mutex> guard(m_soulboundTradableLock);
if (m_itemSoulboundTradeable.empty())
return;
@@ -14385,14 +14385,14 @@ void Player::UpdateSoulboundTradeItems()
void Player::AddTradeableItem(Item* item)
{
ACORE_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock);
std::lock_guard<std::mutex> guard(m_soulboundTradableLock);
m_itemSoulboundTradeable.push_back(item);
}
//TODO: should never allow an item to be added to m_itemSoulboundTradeable twice
void Player::RemoveTradeableItem(Item* item)
{
ACORE_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock);
std::lock_guard<std::mutex> guard(m_soulboundTradableLock);
m_itemSoulboundTradeable.remove(item);
}