[*] Remove deprecated #if 0s from AuWakeOnAdress.cpp

This commit is contained in:
Reece Wilson 2023-12-01 01:44:26 +00:00
parent 0283186046
commit 274a0e1783
2 changed files with 1 additions and 44 deletions

View File

@ -9,18 +9,9 @@
#include "AuWakeOnAddress.hpp"
#include "Primitives/SMTYield.hpp"
#if defined(AURORA_PLATFORM_WIN32)
#include <timeapi.h>
#endif
#if defined(AURORA_IS_LINUX_DERIVED)
#include <unistd.h>
#endif
#include <Time/Time.hpp>
#define HACK_NO_INVALID_ACCESS_LEAK_SHARED_REF_ON_DESTROYED_THREAD
//#define FALLBACK_WAKEONADDRESS_SUPPORTS_NONEXACT_MATCHING
namespace Aurora::Threading
{
@ -168,18 +159,10 @@ namespace Aurora::Threading
bool WaitEntry::TryWakeNoLockNoReallyNoLock(const void *pAddress)
{
#if defined(FALLBACK_WAKEONADDRESS_SUPPORTS_NONEXACT_MATCHING)
if (AuReinterpretCast<const char *>(this->pAddress) > AuReinterpretCast<const char *>(pAddress) ||
AuReinterpretCast<const char *>(this->pAddress) + this->uSize <= AuReinterpretCast<const char *>(pAddress))
{
return false;
}
#else
if (this->pAddress != pAddress)
{
return false;
}
#endif
this->uAtomic = 0;
this->variable.Signal();
@ -188,18 +171,10 @@ namespace Aurora::Threading
bool WaitEntry::TryWakeNoLock(const void *pAddress)
{
#if defined(FALLBACK_WAKEONADDRESS_SUPPORTS_NONEXACT_MATCHING)
if (AuReinterpretCast<const char *>(this->pAddress) > AuReinterpretCast<const char *>(pAddress) ||
AuReinterpretCast<const char *>(this->pAddress) + this->uSize <= AuReinterpretCast<const char *>(pAddress))
{
return false;
}
#else
if (this->pAddress != pAddress)
{
return false;
}
#endif
AU_LOCK_GUARD(this->mutex);
this->uAtomic = 0;
@ -419,36 +394,21 @@ namespace Aurora::Threading
this->uAtomic = 0;
}
#define AddressToIndex AuHashCode(pAddressIDC) & (AuArraySize(this->list) - 1)
#define AddressToIndex AuHashCode(pAddress) & (AuArraySize(this->list) - 1)
WaitEntry *ProcessWaitContainer::WaitBufferFrom(const void *pAddress, AuUInt8 uSize)
{
#if defined(FALLBACK_WAKEONADDRESS_SUPPORTS_NONEXACT_MATCHING)
auto pAddressIDC = (void *)(AuUInt(pAddress) & ~(8 - 1));
#else
auto pAddressIDC = pAddress;
#endif
return this->list[AddressToIndex].WaitBufferFrom(pAddress, uSize);
}
template <typename T>
bool ProcessWaitContainer::IterateWake(const void *pAddress, T callback)
{
#if defined(FALLBACK_WAKEONADDRESS_SUPPORTS_NONEXACT_MATCHING)
auto pAddressIDC = (void *)(AuUInt(pAddress) & ~(8 - 1));
#else
auto pAddressIDC = pAddress;
#endif
return this->list[AddressToIndex].IterateWake(callback);
}
void ProcessWaitContainer::RemoveSelf(const void *pAddress, WaitEntry *pSelf)
{
#if defined(FALLBACK_WAKEONADDRESS_SUPPORTS_NONEXACT_MATCHING)
auto pAddressIDC = (void *)(AuUInt(pAddress) & ~(8 - 1));
#else
auto pAddressIDC = pAddress;
#endif
return this->list[AddressToIndex].RemoveSelf(pSelf);
}

View File

@ -77,9 +77,6 @@ namespace Aurora::Threading
struct ProcessWaitNodeContainer
{
AuUInt32 uAtomic {};
#if defined(WOA_ENABLE_OLD_SHORT_LIST)
WaitEntry entries[kDefaultWaitPerProcess];
#endif
ProcessListWait waitList;
WaitEntry *WaitBufferFrom(const void *pAddress, AuUInt8 uSize);