Reece
d755a9d651
[*] Refactor ambiguous IWaitable::Lock(timeoutMs) to LockMS to prevent final using collisions
42 lines
895 B
C++
42 lines
895 B
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: SpinLock.hpp
|
|
Date: 2021-6-9
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#if defined(AURORA_COMPILER_MSVC)
|
|
#pragma warning(push)
|
|
#pragma warning(disable: 4275)
|
|
#endif
|
|
|
|
namespace Aurora::Threading::Primitives
|
|
{
|
|
struct AUKN_SYM SpinLock : HyperWaitable
|
|
{
|
|
using HyperWaitable::Lock;
|
|
|
|
SpinLock();
|
|
|
|
bool HasOSHandle(AuMach &mach) override;
|
|
bool HasLockImplementation() override;
|
|
|
|
bool LockMS(AuUInt64 timeout) override;
|
|
bool LockNS(AuUInt64 timeout) override;
|
|
bool TryLock() override;
|
|
|
|
void SlowLock() override;
|
|
void Unlock() override;
|
|
};
|
|
|
|
AUKN_SHARED_API(SpinLock, SpinLock);
|
|
|
|
using SpinLockSOO = SpinLock;
|
|
using SpinLockSOO_t = SpinLock;
|
|
}
|
|
|
|
#if defined(AURORA_COMPILER_MSVC)
|
|
#pragma warning(pop)
|
|
#endif |