Remove A version of some fw declarations and macro defines since those are error prone to define, if someone were to include windows.h after that header, it would cause issues
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -38,13 +38,13 @@ namespace AZStd
|
||||
|
||||
binary_semaphore(bool initialState = false)
|
||||
{
|
||||
m_event = CreateEvent(nullptr, false, initialState, nullptr);
|
||||
m_event = CreateEventW(nullptr, false, initialState, nullptr);
|
||||
AZ_Assert(m_event != NULL, "CreateEvent error: %d\n", GetLastError());
|
||||
}
|
||||
binary_semaphore(const char* name, bool initialState = false)
|
||||
{
|
||||
(void)name; // name is used only for debug, if we pass it to the semaphore it will become named semaphore
|
||||
m_event = CreateEvent(nullptr, false, initialState, nullptr);
|
||||
m_event = CreateEventW(nullptr, false, initialState, nullptr);
|
||||
AZ_Assert(m_event != NULL, "CreateEvent error: %d\n", GetLastError());
|
||||
}
|
||||
|
||||
|
||||
@@ -71,19 +71,11 @@ extern "C"
|
||||
using LPSECURITY_ATTRIBUTES = SECURITY_ATTRIBUTES*;
|
||||
|
||||
// Semaphore
|
||||
AZ_DLL_IMPORT HANDLE _stdcall CreateSemaphoreA(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName);
|
||||
AZ_DLL_IMPORT HANDLE _stdcall CreateSemaphoreW(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName);
|
||||
AZ_DLL_IMPORT BOOL _stdcall ReleaseSemaphore(HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount);
|
||||
#ifndef CreateSemaphore
|
||||
#define CreateSemaphore CreateSemaphoreW
|
||||
#endif
|
||||
|
||||
// Event
|
||||
AZ_DLL_IMPORT HANDLE _stdcall CreateEventA(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName);
|
||||
AZ_DLL_IMPORT HANDLE _stdcall CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName);
|
||||
#ifndef CreateEvent
|
||||
#define CreateEvent CreateEventW
|
||||
#endif
|
||||
AZ_DLL_IMPORT BOOL _stdcall SetEvent(HANDLE);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -15,14 +15,14 @@ namespace AZStd
|
||||
{
|
||||
inline semaphore::semaphore(unsigned int initialCount, unsigned int maximumCount)
|
||||
{
|
||||
m_semaphore = CreateSemaphore(NULL, initialCount, maximumCount, 0);
|
||||
m_semaphore = CreateSemaphoreW(NULL, initialCount, maximumCount, 0);
|
||||
AZ_Assert(m_semaphore != NULL, "CreateSemaphore error: %d\n", GetLastError());
|
||||
}
|
||||
|
||||
inline semaphore::semaphore(const char* name, unsigned int initialCount, unsigned int maximumCount)
|
||||
{
|
||||
(void)name; // name is used only for debug, if we pass it to the semaphore it will become named semaphore
|
||||
m_semaphore = CreateSemaphore(NULL, initialCount, maximumCount, 0);
|
||||
m_semaphore = CreateSemaphoreW(NULL, initialCount, maximumCount, 0);
|
||||
AZ_Assert(m_semaphore != NULL, "CreateSemaphore error: %d\n", GetLastError());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user