AuroraRuntime/Source/Threading/Primitives/AuMutex.Generic.hpp
Jamie Reece Wilson 62b6fa20f8 [*] Update the copyright header of most of the primitives
[*] Fix generic mutex abs yield always returning true
2024-01-29 14:48:04 +00:00

42 lines
1.1 KiB
C++

/***
Copyright (C) 2021-2024 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Mutex.Generic.hpp
Date: 2021-6-12
Author: Reece
***/
#pragma once
#if defined(AURORA_IS_MODERNNT_DERIVED)
#include "AuMutex.NT.hpp"
#elif defined(AURORA_IS_LINUX_DERIVED)
#include "AuMutex.Linux.hpp"
#else
#define _AURUNTIME_GENERIC_MUTEX
namespace Aurora::Threading::Primitives
{
struct MutexGenericImpl final : IHyperWaitable
{
MutexGenericImpl();
~MutexGenericImpl();
bool HasOSHandle(AuMach &mach) override;
bool TryLock() override;
bool HasLockImplementation() override;
void SlowLock() override;
bool LockMS(AuUInt64 timeout) override;
bool LockNS(AuUInt64 timeout) override;
bool LockAbsNS(AuUInt64 uTimeout) override;
void Unlock() override;
auline bool TryLockNoSpin();
auline bool TryLockHeavy();
private:
AuUInt32 dwSleeping_ {};
};
using MutexImpl = MutexGenericImpl;
}
#endif