AuroraRuntime/Source/Threading/Primitives/AuSemaphore.Generic.hpp
Jamie Reece Wilson 5862dbeacc [+] New generic primitives
[-] AuSemaphore.Unix.hpp
[*] Moved the old pthread based primitives to _removed/*.bak
[+] AuWoASemaphore.Unix.cpp
[+] AuWoASemaphore.Unix.hpp
2023-12-29 16:12:14 +00:00

55 lines
1.3 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuSemaphore.Generic.hpp
Date: 2021-6-12
Author: Reece
***/
#pragma once
#if defined(AURORA_IS_MODERNNT_DERIVED)
#include "AuSemaphore.NT.hpp"
#elif defined(AURORA_IS_LINUX_DERIVED)
#include "AuSemaphore.Linux.hpp"
#else
#define _AURUNTIME_GENERIC_SEMAPHORE
namespace Aurora::Threading::Primitives
{
struct SemaphoreGeneric : ISemaphore
{
SemaphoreGeneric(AuUInt16 uIntialValue = 0);
~SemaphoreGeneric();
auline bool TryLockNoSpin();
auline bool TryLockHeavy();
bool TryLock() override;
bool HasOSHandle(AuMach &mach) override;
bool HasLockImplementation() override;
void Unlock() override;
void Unlock(AuUInt16 uThreads) override;
void Lock() override;
bool LockMS(AuUInt64 qwTimeout) override;
bool LockAbsMS(AuUInt64 qwTimeout) override;
bool LockNS(AuUInt64 qwTimeout) override;
bool LockAbsNS(AuUInt64 qwTimeoutAbs) override;
AuAUInt32 uAtomicState {};
AuAUInt32 uAtomicSleeping {};
};
using SemaphoreImpl = SemaphoreGeneric;
}
#endif