[redcode/crythread-2nd-pass] removed or replaced remaining CryMutex/CryLock usage with equivalent AZStd version
Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
@@ -72,7 +72,7 @@ bool CryAssert(const char* szCondition, const char* szFile, unsigned int line, b
|
||||
|
||||
static const int max_len = 4096;
|
||||
static char gs_command_str[4096];
|
||||
static CryLockT<CRYLOCK_RECURSIVE> lock;
|
||||
static AZStd::recursive_mutex lock;
|
||||
|
||||
gEnv->pSystem->OnAssert(szCondition, gs_szMessage, szFile, line);
|
||||
|
||||
@@ -80,7 +80,7 @@ bool CryAssert(const char* szCondition, const char* szFile, unsigned int line, b
|
||||
|
||||
if (!gEnv->bNoAssertDialog && !gEnv->bIgnoreAllAsserts)
|
||||
{
|
||||
CryAutoLock< CryLockT<CRYLOCK_RECURSIVE> > lk (lock);
|
||||
AZStd::lock_guard<AZStd::recursive_mutex> lk (lock);
|
||||
snprintf(gs_command_str, max_len, "xterm -geometry 100x20 -n 'Assert Dialog [Linux Launcher]' -T 'Assert Dialog [Linux Launcher]' -e 'BinLinux/assert_term \"%s\" \"%s\" %d \"%s\"; echo \"$?\" > .assert_return'",
|
||||
szCondition, (file_len > 60) ? szFile + (file_len - 61) : szFile, line, gs_szMessage);
|
||||
int ret = system(gs_command_str);
|
||||
|
||||
@@ -70,8 +70,6 @@ bool CryAssert(const char* szCondition, const char* szFile, unsigned int line, b
|
||||
static const int max_len = 4096;
|
||||
static char gs_command_str[4096];
|
||||
|
||||
static CryLockT<CRYLOCK_RECURSIVE> lock;
|
||||
|
||||
gEnv->pSystem->OnAssert(szCondition, gs_szMessage, szFile, line);
|
||||
|
||||
size_t file_len = strlen(szFile);
|
||||
|
||||
@@ -432,8 +432,6 @@ struct IMaterial
|
||||
virtual uint32 GetDccMaterialHash() const = 0;
|
||||
virtual void SetDccMaterialHash(uint32 hash) = 0;
|
||||
|
||||
virtual CryCriticalSection& GetSubMaterialResizeLock() = 0;
|
||||
|
||||
virtual void UpdateShaderItems() = 0;
|
||||
|
||||
// </interfuscator:shuffle>
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace CryMT
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef std::vector<T, Alloc> container_type;
|
||||
typedef CryAutoCriticalSection AutoLock;
|
||||
typedef AZStd::lock_guard<AZStd::recursive_mutex> AutoLock;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// std::queue interface
|
||||
@@ -46,7 +46,7 @@ namespace CryMT
|
||||
// classic pop function of queue should not be used for thread safety, use try_pop instead
|
||||
//void pop() { AutoLock lock(m_cs); return v.erase(v.begin()); };
|
||||
|
||||
CryCriticalSection& get_lock() const { return m_cs; }
|
||||
AZStd::recursive_mutex& get_lock() const { return m_cs; }
|
||||
|
||||
bool empty() const { AutoLock lock(m_cs); return v.empty(); }
|
||||
int size() const { AutoLock lock(m_cs); return v.size(); }
|
||||
@@ -92,7 +92,7 @@ namespace CryMT
|
||||
}
|
||||
private:
|
||||
container_type v;
|
||||
mutable CryCriticalSection m_cs;
|
||||
mutable AZStd::recursive_mutex m_cs;
|
||||
};
|
||||
}; // namespace CryMT
|
||||
|
||||
|
||||
@@ -309,8 +309,8 @@ private:
|
||||
TLocalizationBitfield m_availableLocalizations;
|
||||
|
||||
//Lock for
|
||||
mutable CryCriticalSection m_cs;
|
||||
typedef CryAutoCriticalSection AutoLock;
|
||||
mutable AZStd::mutex m_cs;
|
||||
typedef AZStd::lock_guard<AZStd::mutex> AutoLock;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -32,17 +32,6 @@
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
|
||||
// Only accept logging from the main thread.
|
||||
#ifdef WIN32
|
||||
|
||||
#define THREAD_SAFE_LOG
|
||||
//#define THREAD_SAFE_LOG CryAutoCriticalSection scope_lock(m_logCriticalSection);
|
||||
|
||||
#else
|
||||
#define THREAD_SAFE_LOG
|
||||
#endif //WIN32
|
||||
|
||||
#define LOG_BACKUP_PATH "@log@/LogBackups"
|
||||
|
||||
#if defined(IOS)
|
||||
@@ -822,13 +811,13 @@ void CLog::PushAssetScopeName(const char* sAssetType, const char* sName)
|
||||
SAssetScopeInfo as;
|
||||
as.sType = sAssetType;
|
||||
as.sName = sName;
|
||||
CryAutoCriticalSection scope_lock(m_assetScopeQueueLock);
|
||||
AZStd::lock_guard<AZStd::mutex> scope_lock(m_assetScopeQueueLock);
|
||||
m_assetScopeQueue.push_back(as);
|
||||
}
|
||||
|
||||
void CLog::PopAssetScopeName()
|
||||
{
|
||||
CryAutoCriticalSection scope_lock(m_assetScopeQueueLock);
|
||||
AZStd::lock_guard<AZStd::mutex> scope_lock(m_assetScopeQueueLock);
|
||||
assert(!m_assetScopeQueue.empty());
|
||||
if (!m_assetScopeQueue.empty())
|
||||
{
|
||||
@@ -839,7 +828,7 @@ void CLog::PopAssetScopeName()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
const char* CLog::GetAssetScopeString()
|
||||
{
|
||||
CryAutoCriticalSection scope_lock(m_assetScopeQueueLock);
|
||||
AZStd::lock_guard<AZStd::mutex> scope_lock(m_assetScopeQueueLock);
|
||||
|
||||
m_assetScopeString.clear();
|
||||
for (size_t i = 0; i < m_assetScopeQueue.size(); i++)
|
||||
@@ -1470,7 +1459,7 @@ void CLog::Update()
|
||||
{
|
||||
if (!m_threadSafeMsgQueue.empty())
|
||||
{
|
||||
CryAutoCriticalSection lock(m_threadSafeMsgQueue.get_lock()); // Get the lock and hold onto it until we clear the entire queue (prevents other threads adding more things in while we clear it)
|
||||
AZStd::lock_guard<AZStd::recursive_mutex> lock(m_threadSafeMsgQueue.get_lock()); // Get the lock and hold onto it until we clear the entire queue (prevents other threads adding more things in while we clear it)
|
||||
// Must be called from main thread
|
||||
SLogMsg msg;
|
||||
while (m_threadSafeMsgQueue.try_pop(msg))
|
||||
|
||||
@@ -168,7 +168,7 @@ private: // -------------------------------------------------------------------
|
||||
};
|
||||
|
||||
std::vector<SAssetScopeInfo> m_assetScopeQueue;
|
||||
CryCriticalSection m_assetScopeQueueLock;
|
||||
AZStd::mutex m_assetScopeQueueLock;
|
||||
string m_assetScopeString;
|
||||
#endif
|
||||
|
||||
@@ -176,8 +176,6 @@ private: // -------------------------------------------------------------------
|
||||
|
||||
IConsole* m_pConsole; //
|
||||
|
||||
CryCriticalSection m_logCriticalSection;
|
||||
|
||||
struct SLogHistoryItem
|
||||
{
|
||||
char str[MAX_WARNING_LENGTH];
|
||||
|
||||
@@ -17,17 +17,17 @@ CSystemEventDispatcher::CSystemEventDispatcher()
|
||||
|
||||
bool CSystemEventDispatcher::RegisterListener(ISystemEventListener* pListener)
|
||||
{
|
||||
m_listenerRegistrationLock.Lock();
|
||||
m_listenerRegistrationLock.lock();
|
||||
bool ret = m_listeners.Add(pListener);
|
||||
m_listenerRegistrationLock.Unlock();
|
||||
m_listenerRegistrationLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CSystemEventDispatcher::RemoveListener(ISystemEventListener* pListener)
|
||||
{
|
||||
m_listenerRegistrationLock.Lock();
|
||||
m_listenerRegistrationLock.lock();
|
||||
m_listeners.Remove(pListener);
|
||||
m_listenerRegistrationLock.Unlock();
|
||||
m_listenerRegistrationLock.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,12 +35,12 @@ bool CSystemEventDispatcher::RemoveListener(ISystemEventListener* pListener)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystemEventDispatcher::OnSystemEventAnyThread(ESystemEvent event, UINT_PTR wparam, UINT_PTR lparam)
|
||||
{
|
||||
m_listenerRegistrationLock.Lock();
|
||||
m_listenerRegistrationLock.lock();
|
||||
for (TSystemEventListeners::Notifier notifier(m_listeners); notifier.IsValid(); notifier.Next())
|
||||
{
|
||||
notifier->OnSystemEventAnyThread(event, wparam, lparam);
|
||||
}
|
||||
m_listenerRegistrationLock.Unlock();
|
||||
m_listenerRegistrationLock.unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
|
||||
typedef CryMT::queue<SEventParams> TSystemEventQueue;
|
||||
TSystemEventQueue m_systemEventQueue;
|
||||
CryCriticalSection m_listenerRegistrationLock;
|
||||
AZStd::recursive_mutex m_listenerRegistrationLock;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYSYSTEM_SYSTEMEVENTDISPATCHER_H
|
||||
|
||||
Reference in New Issue
Block a user