[development] complete removal of CryThread*.h and MultiThread.h from CryCommon (#3067)

- Replaced Cry-threading related code with AZ equivalents in the Remote Console runtime
 - Replaced (or removed) usage of CryMutex/CryLock with appropriate AZStd mutex type
 - Replaced usage of CrySpinLock/CryWriteLock with equivalent AZStd::spin_mutex
 - Replaced usage of CryInterlocked* with AZStd atomics
 - Removed all CryThread*.h files
 - Removed MultiThread.h
 -- Includes removal of the CryInterlocked* and Cry*CriticalSection functions defined elsewhere
 - Removed re-implemented stubs of Windows synchapi.h functions

Signed-off-by: AMZN-ScottR 24445312+AMZN-ScottR@users.noreply.github.com
This commit is contained in:
Scott Romero
2021-08-13 05:43:21 -07:00
committed by GitHub
41 changed files with 156 additions and 3118 deletions
+8 -11
View File
@@ -891,8 +891,7 @@ CCrySingleDocTemplate::Confidence CCrySingleDocTemplate::MatchDocType(const char
/////////////////////////////////////////////////////////////////////////////
namespace
{
CryMutex g_splashScreenStateLock;
CryConditionVariable g_splashScreenStateChange;
AZStd::mutex g_splashScreenStateLock;
enum ESplashScreenState
{
eSplashScreenState_Init, eSplashScreenState_Started, eSplashScreenState_Destroy
@@ -923,7 +922,7 @@ QString FormatRichTextCopyrightNotice()
/////////////////////////////////////////////////////////////////////////////
void CCryEditApp::ShowSplashScreen(CCryEditApp* app)
{
g_splashScreenStateLock.Lock();
g_splashScreenStateLock.lock();
CStartupLogoDialog* splashScreen = new CStartupLogoDialog(FormatVersion(app->m_pEditor->GetFileVersion()), FormatRichTextCopyrightNotice());
@@ -931,8 +930,7 @@ void CCryEditApp::ShowSplashScreen(CCryEditApp* app)
g_splashScreen = splashScreen;
g_splashScreenState = eSplashScreenState_Started;
g_splashScreenStateLock.Unlock();
g_splashScreenStateChange.Notify();
g_splashScreenStateLock.unlock();
splashScreen->show();
// Make sure the initial paint of the splash screen occurs so we dont get stuck with a blank window
@@ -940,10 +938,9 @@ void CCryEditApp::ShowSplashScreen(CCryEditApp* app)
QObject::connect(splashScreen, &QObject::destroyed, splashScreen, [=]
{
g_splashScreenStateLock.Lock();
AZStd::scoped_lock lock(g_splashScreenStateLock);
g_pInitializeUIInfo = nullptr;
g_splashScreen = nullptr;
g_splashScreenStateLock.Unlock();
});
}
@@ -973,9 +970,9 @@ void CCryEditApp::CloseSplashScreen()
if (CStartupLogoDialog::instance())
{
delete CStartupLogoDialog::instance();
g_splashScreenStateLock.Lock();
g_splashScreenStateLock.lock();
g_splashScreenState = eSplashScreenState_Destroy;
g_splashScreenStateLock.Unlock();
g_splashScreenStateLock.unlock();
}
GetIEditor()->Notify(eNotify_OnSplashScreenDestroyed);
@@ -984,12 +981,12 @@ void CCryEditApp::CloseSplashScreen()
/////////////////////////////////////////////////////////////////////////////
void CCryEditApp::OutputStartupMessage(QString str)
{
g_splashScreenStateLock.Lock();
g_splashScreenStateLock.lock();
if (g_pInitializeUIInfo)
{
g_pInitializeUIInfo->SetInfoText(str.toUtf8().data());
}
g_splashScreenStateLock.Unlock();
g_splashScreenStateLock.unlock();
}
//////////////////////////////////////////////////////////////////////////
+2 -3
View File
@@ -20,7 +20,6 @@
#include "LogFile.h"
#include "CryListenerSet.h"
#include "Util/ModalWindowDismisser.h"
#include <CryCommon/CryThread.h>
#endif
class CStartupLogoDialog;
@@ -117,11 +116,11 @@ public:
//! mutex used by other threads to lock up the PAK modification,
//! so only one thread can modify the PAK at once
static CryMutex& GetPakModifyMutex()
static AZStd::recursive_mutex& GetPakModifyMutex()
{
//! mutex used to halt copy process while the export to game
//! or other pak operation is done in the main thread
static CryMutex s_pakModifyMutex;
static AZStd::recursive_mutex s_pakModifyMutex;
return s_pakModifyMutex;
}
+1 -1
View File
@@ -136,7 +136,7 @@ bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportE
m_settings.SetHiQuality();
}
CryAutoLock<CryMutex> autoLock(CGameEngine::GetPakModifyMutex());
AZStd::scoped_lock autoLock(CGameEngine::GetPakModifyMutex());
// Close this pak file.
if (!CloseLevelPack(m_levelPak, true))
+3 -3
View File
@@ -252,7 +252,7 @@ void CEditorImpl::Uninitialize()
void CEditorImpl::UnloadPlugins()
{
CryAutoLock<CryMutex> lock(m_pluginMutex);
AZStd::scoped_lock lock(m_pluginMutex);
// Flush core buses. We're about to unload DLLs and need to ensure we don't have module-owned functions left behind.
AZ::Data::AssetBus::ExecuteQueuedEvents();
@@ -273,7 +273,7 @@ void CEditorImpl::UnloadPlugins()
void CEditorImpl::LoadPlugins()
{
CryAutoLock<CryMutex> lock(m_pluginMutex);
AZStd::scoped_lock lock(m_pluginMutex);
static const QString editor_plugins_folder("EditorPlugins");
@@ -1460,7 +1460,7 @@ void CEditorImpl::UnregisterNotifyListener(IEditorNotifyListener* listener)
ISourceControl* CEditorImpl::GetSourceControl()
{
CryAutoLock<CryMutex> lock(m_pluginMutex);
AZStd::scoped_lock lock(m_pluginMutex);
if (m_pSourceControl)
{
+1 -1
View File
@@ -401,7 +401,7 @@ protected:
IImageUtil* m_pImageUtil; // Vladimir@conffx
ILogFile* m_pLogFile; // Vladimir@conffx
CryMutex m_pluginMutex; // protect any pointers that come from plugins, such as the source control cached pointer.
AZStd::mutex m_pluginMutex; // protect any pointers that come from plugins, such as the source control cached pointer.
static const char* m_crashLogFileName;
};
@@ -9,7 +9,6 @@
#include "CryFile.h"
#include "PerforceSourceControl.h"
#include "PasswordDlg.h"
#include <CryCommon/CryThread.h>
#include <QSettings>
#include <QDir>
@@ -23,7 +22,7 @@
namespace
{
CryCriticalSection g_cPerforceValues;
AZStd::mutex g_cPerforceValues;
}
////////////////////////////////////////////////////////////
@@ -31,9 +30,9 @@ ULONG STDMETHODCALLTYPE CPerforceSourceControl::Release()
{
if ((--m_ref) == 0)
{
g_cPerforceValues.Lock();
g_cPerforceValues.lock();
delete this;
g_cPerforceValues.Unlock();
g_cPerforceValues.unlock();
return 0;
}
else
@@ -57,7 +56,7 @@ void CPerforceSourceControl::ShowSettings()
void CPerforceSourceControl::SetSourceControlState(SourceControlState state)
{
CryAutoLock<CryCriticalSection> lock(g_cPerforceValues);
AZStd::scoped_lock lock(g_cPerforceValues);
switch (state)
{
-1
View File
@@ -9,7 +9,6 @@
#pragma once
#include "CryThread.h"
#include "../Include/SandboxAPI.h"
#include <QString>
#include <QFileInfo>
+2
View File
@@ -22,6 +22,8 @@ AZ_PUSH_DISABLE_WARNING(4458, "-Wunknown-warning-option")
AZ_POP_DISABLE_WARNING
#include <QVariant>
#include <StlUtils.h>
inline const char* to_c_str(const char* str) { return str; }
#define MAX_VAR_STRING_LENGTH 4096