[redcode/crythread-2nd-pass] removed CryThread*.h files

Signed-off-by: AMZN-ScottR <24445312+AMZN-ScottR@users.noreply.github.com>
This commit is contained in:
AMZN-ScottR
2021-08-10 21:27:22 -07:00
parent f99f1f00f4
commit 6f2b7baae8
16 changed files with 7 additions and 524 deletions
+1
View File
@@ -14,6 +14,7 @@
#include <AzCore/PlatformIncl.h>
#include <CryCommon/platform.h>
#include <CryCommon/Cry_Geo.h>
#include <set>
// forward declarations.
class CEntityObject;
+2
View File
@@ -15,6 +15,8 @@
#include "Util/GuidUtil.h"
#include "ErrorReport.h"
#include <set>
class CPakFile;
class CErrorRecord;
struct IObjectManager;
+1
View File
@@ -12,6 +12,7 @@
#include <QString>
#include <CryString.h>
#include "UnicodeFunctions.h"
#include <StlUtils.h>
#include <QApplication>
#include <QDropEvent>
-1
View File
@@ -9,7 +9,6 @@
#pragma once
#include "CryThread.h"
#include "StringUtils.h"
#include "../Include/SandboxAPI.h"
#include <QString>
+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
-110
View File
@@ -1,110 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
// Description : Public include file for the multi-threading API.
#pragma once
// Include basic multithread primitives.
#include "MultiThread.h"
#include "BitFiddling.h"
#include <AzCore/std/string/string.h>
//////////////////////////////////////////////////////////////////////////
// Lock types:
//
// CRYLOCK_FAST
// A fast potentially (non-recursive) mutex.
// CRYLOCK_RECURSIVE
// A recursive mutex.
//////////////////////////////////////////////////////////////////////////
enum CryLockType
{
CRYLOCK_FAST = 1,
CRYLOCK_RECURSIVE = 2,
};
#define CRYLOCK_HAVE_FASTLOCK 1
/////////////////////////////////////////////////////////////////////////////
//
// Primitive locks and conditions.
//
// Primitive locks are represented by instance of class CryLockT<Type>
//
//
template<CryLockType Type>
class CryLockT
{
/* Unsupported lock type. */
};
//////////////////////////////////////////////////////////////////////////
// Typedefs.
//////////////////////////////////////////////////////////////////////////
typedef CryLockT<CRYLOCK_RECURSIVE> CryCriticalSection;
typedef CryLockT<CRYLOCK_FAST> CryCriticalSectionNonRecursive;
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//
// CryAutoCriticalSection implements a helper class to automatically
// lock critical section in constructor and release on destructor.
//
//////////////////////////////////////////////////////////////////////////
template<class LockClass>
class CryAutoLock
{
private:
LockClass* m_pLock;
CryAutoLock();
CryAutoLock(const CryAutoLock<LockClass>&);
CryAutoLock<LockClass>& operator = (const CryAutoLock<LockClass>&);
public:
CryAutoLock(LockClass& Lock)
: m_pLock(&Lock) { m_pLock->Lock(); }
CryAutoLock(const LockClass& Lock)
: m_pLock(const_cast<LockClass*>(&Lock)) { m_pLock->Lock(); }
~CryAutoLock() { m_pLock->Unlock(); }
};
//////////////////////////////////////////////////////////////////////////
//
// Auto critical section is the most commonly used type of auto lock.
//
//////////////////////////////////////////////////////////////////////////
typedef CryAutoLock<CryCriticalSection> CryAutoCriticalSection;
///////////////////////////////////////////////////////////////////////////////
// Include architecture specific code.
#if AZ_LEGACY_CRYCOMMON_TRAIT_USE_PTHREADS
#include <CryThread_pthreads.h>
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(WIN32) || defined(WIN64)
#include <CryThread_windows.h>
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(AZ_RESTRICTED_PLATFORM)
#include AZ_RESTRICTED_FILE(CryThread_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
// Put other platform specific includes here!
#endif
#if !defined _CRYTHREAD_CONDLOCK_GLITCH
typedef CryLockT<CRYLOCK_RECURSIVE> CryMutex;
#endif // !_CRYTHREAD_CONDLOCK_GLITCH
// Include all multithreading containers.
#include "MultiThread_Containers.h"
-29
View File
@@ -1,29 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <CryThread.h>
// Include architecture specific code.
#if defined(LINUX) || defined(APPLE)
// noting to include
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(WIN32) || defined(WIN64)
#include <CryThreadImpl_windows.h>
#define AZ_RESTRICTED_SECTION_IMPLEMENTED
#elif defined(AZ_RESTRICTED_PLATFORM)
#include AZ_RESTRICTED_FILE(CryThreadImpl_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
// Put other platform specific includes here!
#endif
@@ -1,78 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/PlatformIncl.h>
#include <AzCore/std/parallel/semaphore.h> // for CreateSemaphore
//////////////////////////////////////////////////////////////////////////
// CryLock_WinMutex
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
CryLock_WinMutex::CryLock_WinMutex()
: m_hdl(CreateMutex(NULL, FALSE, NULL)) {}
CryLock_WinMutex::~CryLock_WinMutex()
{
CloseHandle(m_hdl);
}
//////////////////////////////////////////////////////////////////////////
void CryLock_WinMutex::Lock()
{
WaitForSingleObject(m_hdl, INFINITE);
}
//////////////////////////////////////////////////////////////////////////
void CryLock_WinMutex::Unlock()
{
ReleaseMutex(m_hdl);
}
//////////////////////////////////////////////////////////////////////////
bool CryLock_WinMutex::TryLock()
{
return WaitForSingleObject(m_hdl, 0) != WAIT_TIMEOUT;
}
//////////////////////////////////////////////////////////////////////////
// CryLock_CritSection
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
CryLock_CritSection::CryLock_CritSection()
{
InitializeCriticalSection((CRITICAL_SECTION*)&m_cs);
}
//////////////////////////////////////////////////////////////////////////
CryLock_CritSection::~CryLock_CritSection()
{
DeleteCriticalSection((CRITICAL_SECTION*)&m_cs);
}
//////////////////////////////////////////////////////////////////////////
void CryLock_CritSection::Lock()
{
EnterCriticalSection((CRITICAL_SECTION*)&m_cs);
}
//////////////////////////////////////////////////////////////////////////
void CryLock_CritSection::Unlock()
{
LeaveCriticalSection((CRITICAL_SECTION*)&m_cs);
}
//////////////////////////////////////////////////////////////////////////
bool CryLock_CritSection::TryLock()
{
return TryEnterCriticalSection((CRITICAL_SECTION*)&m_cs) != FALSE;
}
-199
View File
@@ -1,199 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/PlatformRestrictedFileDef.h>
#include <sys/types.h>
#include <sys/time.h>
#include <pthread.h>
#include <semaphore.h>
#include <sched.h>
#include <ISystem.h>
#include <ILog.h>
#include <errno.h>
// Section dictionary
#if defined(AZ_RESTRICTED_PLATFORM)
#define CRYTHREAD_PTHREADS_H_SECTION_REGISTER_THREAD 1
#define CRYTHREAD_PTHREADS_H_SECTION_TRAITS 2
#define CRYTHREAD_PTHREADS_H_SECTION_PTHREADCOND 3
#define CRYTHREAD_PTHREADS_H_SECTION_SEMAPHORE_CONSTRUCT 4
#define CRYTHREAD_PTHREADS_H_SECTION_SEMAPHORE_DESTROY 5
#define CRYTHREAD_PTHREADS_H_SECTION_SEMAPHORE_ACQUIRE 6
#define CRYTHREAD_PTHREADS_H_SECTION_SEMAPHORE_RELEASE 7
#define CRYTHREAD_PTHREADS_H_SECTION_TRY_RLOCK 8
#define CRYTHREAD_PTHREADS_H_SECTION_TRY_WLOCK 9
#define CRYTHREAD_PTHREADS_H_SECTION_START_RUNNABLE 10
#define CRYTHREAD_PTHREADS_H_SECTION_START_CPUMASK 11
#define CRYTHREAD_PTHREADS_H_SECTION_START_CPUMASK_POSTCREATE 12
#define CRYTHREAD_PTHREADS_H_SECTION_SETCPUMASK 13
#define CRYTHREAD_PTHREADS_H_SECTION_START_RUNNABLE_CPUMASK_POSTCREATE 14
#endif
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION CRYTHREAD_PTHREADS_H_SECTION_REGISTER_THREAD
#include AZ_RESTRICTED_FILE(CryThread_pthreads_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#endif
#if defined(APPLE) || defined(ANDROID)
// PTHREAD_MUTEX_FAST_NP is only defined by Pthreads-w32, thus not on MAC
#define PTHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL
#endif
#if !defined _CRYTHREAD_HAVE_LOCK
template<int PthreadMutexType>
class _PthreadLockBase;
template<int PthreadMutexType>
class _PthreadLockAttr
{
friend class _PthreadLockBase<PthreadMutexType>;
protected:
_PthreadLockAttr()
{
pthread_mutexattr_init(&m_Attr);
pthread_mutexattr_settype(&m_Attr, PthreadMutexType);
}
~_PthreadLockAttr()
{
pthread_mutexattr_destroy(&m_Attr);
}
pthread_mutexattr_t m_Attr;
};
template<int PthreadMutexType>
class _PthreadLockBase
{
protected:
static pthread_mutexattr_t& GetAttr()
{
static _PthreadLockAttr<PthreadMutexType> m_Attr;
return m_Attr.m_Attr;
}
};
template<class LockClass, int PthreadMutexType>
class _PthreadLock
: public _PthreadLockBase<PthreadMutexType>
{
//#if defined(_DEBUG)
public:
//#endif
pthread_mutex_t m_Lock;
public:
_PthreadLock()
: LockCount(0)
{
pthread_mutex_init(
&m_Lock,
&_PthreadLockBase<PthreadMutexType>::GetAttr());
}
~_PthreadLock() { pthread_mutex_destroy(&m_Lock); }
void Lock() { pthread_mutex_lock(&m_Lock); CryInterlockedIncrement(&LockCount); }
bool TryLock()
{
const int rc = pthread_mutex_trylock(&m_Lock);
if (0 == rc)
{
CryInterlockedIncrement(&LockCount);
return true;
}
return false;
}
void Unlock() { CryInterlockedDecrement(&LockCount); pthread_mutex_unlock(&m_Lock); }
// Get the POSIX pthread_mutex_t.
// Warning:
// This method will not be available in the Win32 port of CryThread.
pthread_mutex_t& Get_pthread_mutex_t() { return m_Lock; }
bool IsLocked()
{
#if defined(LINUX) || defined(APPLE)
// implementation taken from CrysisWars
return LockCount > 0;
#else
return true;
#endif
}
private:
volatile int LockCount;
};
#if defined CRYLOCK_HAVE_FASTLOCK
#if defined(_DEBUG) && defined(PTHREAD_MUTEX_ERRORCHECK_NP)
template<>
class CryLockT<CRYLOCK_FAST>
: public _PthreadLock<CryLockT<CRYLOCK_FAST>, PTHREAD_MUTEX_ERRORCHECK_NP>
#else
template<>
class CryLockT<CRYLOCK_FAST>
: public _PthreadLock<CryLockT<CRYLOCK_FAST>, PTHREAD_MUTEX_FAST_NP>
#endif
{
CryLockT(const CryLockT<CRYLOCK_FAST>&);
void operator = (const CryLockT<CRYLOCK_FAST>&);
public:
CryLockT() { }
};
#endif // CRYLOCK_HAVE_FASTLOCK
template<>
class CryLockT<CRYLOCK_RECURSIVE>
: public _PthreadLock<CryLockT<CRYLOCK_RECURSIVE>, PTHREAD_MUTEX_RECURSIVE>
{
CryLockT(const CryLockT<CRYLOCK_RECURSIVE>&);
void operator = (const CryLockT<CRYLOCK_RECURSIVE>&);
public:
CryLockT() { }
};
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION CRYTHREAD_PTHREADS_H_SECTION_TRAITS
#include AZ_RESTRICTED_FILE(CryThread_pthreads_h)
#else
#if !defined(LINUX) && !defined(APPLE)
#define CRYTHREAD_PTHREADS_H_TRAIT_DEFINE_CRYMUTEX 1
#endif
#endif
#if CRYTHREAD_PTHREADS_H_TRAIT_DEFINE_CRYMUTEX
#if defined CRYLOCK_HAVE_FASTLOCK
class CryMutex
: public CryLockT<CRYLOCK_FAST>
{
};
#else
class CryMutex
: public CryLockT<CRYLOCK_RECURSIVE>
{
};
#endif
#endif // CRYTHREAD_PTHREADS_TRAIT_DEFINE_CRYMUTEX
#define _CRYTHREAD_HAVE_LOCK 1
#endif // !defined _CRYTHREAD_HAVE_LOCK
#include "MemoryAccess.h"
-95
View File
@@ -1,95 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <process.h>
#if defined(AZ_RESTRICTED_PLATFORM)
#undef AZ_RESTRICTED_SECTION
#define CRYTHREAD_WINDOWS_H_SECTION_1 1
#define CRYTHREAD_WINDOWS_H_SECTION_2 2
#endif
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// from winnt.h
struct CRY_CRITICAL_SECTION
{
void* DebugInfo;
long LockCount;
long RecursionCount;
threadID OwningThread;
void* LockSemaphore;
unsigned long* SpinCount; // force size on 64-bit systems when packed
};
//////////////////////////////////////////////////////////////////////////
// kernel mutex - don't use... use CryMutex instead
class CryLock_WinMutex
{
public:
CryLock_WinMutex();
~CryLock_WinMutex();
void Lock();
void Unlock();
bool TryLock();
void* _get_win32_handle() { return m_hdl; }
private:
CryLock_WinMutex(const CryLock_WinMutex&);
CryLock_WinMutex& operator = (const CryLock_WinMutex&);
private:
void* m_hdl;
};
// critical section... don't use... use CryCriticalSection instead
class CryLock_CritSection
{
public:
CryLock_CritSection();
~CryLock_CritSection();
void Lock();
void Unlock();
bool TryLock();
bool IsLocked()
{
return m_cs.RecursionCount > 0 && m_cs.OwningThread == CryGetCurrentThreadId();
}
private:
CryLock_CritSection(const CryLock_CritSection&);
CryLock_CritSection& operator = (const CryLock_CritSection&);
private:
CRY_CRITICAL_SECTION m_cs;
};
template <>
class CryLockT<CRYLOCK_RECURSIVE>
: public CryLock_CritSection
{
};
template <>
class CryLockT<CRYLOCK_FAST>
: public CryLock_CritSection
{
};
class CryMutex
: public CryLock_WinMutex
{
};
#define _CRYTHREAD_CONDLOCK_GLITCH 1
-1
View File
@@ -22,7 +22,6 @@
//---------------------------------------------------------------------------
#include "MultiThread.h"
#include "CryThread.h"
namespace stl
{
@@ -89,8 +89,6 @@ set(FILES
CrySizer.h
CryString.h
CrySystemBus.h
CryThread.h
CryThreadImpl.h
CryTypeInfo.h
CryVersion.h
FrameProfiler.h
@@ -160,9 +158,6 @@ set(FILES
CryAssert_Mac.h
CryLibrary.cpp
CryLibrary.h
CryThread_pthreads.h
CryThread_windows.h
CryThreadImpl_windows.h
CryWindows.h
Linux32Specific.h
Linux64Specific.h
-1
View File
@@ -732,7 +732,6 @@ typedef int socklen_t;
// Include MultiThreading support.
#include "CryThread.h"
#include "MultiThread.h"
// In RELEASE disable printf and fprintf
-4
View File
@@ -38,10 +38,6 @@ struct SSystemGlobalEnvironment* gEnv = nullptr;
#include AZ_RESTRICTED_FILE(platform_impl_h)
#endif
//////////////////////////////////////////////////////////////////////////
// If not in static library.
#include <CryThreadImpl.h>
#if defined(WIN32) || defined(WIN64)
void CryPureCallHandler()
{
-1
View File
@@ -10,7 +10,6 @@
#pragma once
#include <ILog.h>
#include <CryThread.h>
#include <MultiThread.h>
#include <MultiThread_Containers.h>
@@ -14,6 +14,7 @@
#include <ISystem.h>
#include <CryListenerSet.h>
#include <MultiThread_Containers.h>
class CSystemEventDispatcher
: public ISystemEventDispatcher