AuroraRuntime/Include/Aurora/Threading/Primitives/SpinLock.hpp
Reece 749b8deb8d [*] Updated bit utilities
[*] Updated default string type
[*] Spinlocks can now timeout
[*] Finish RW lock write entrant mode
2022-02-18 17:50:33 +00:00

33 lines
746 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
namespace Aurora::Threading::Primitives
{
// NOTE: A SPINLOCK CAN NOT BE AN IWAITABLE BY DEFINITION
// Partial interface support exists for completeness alone!
class AUKN_SYM SpinLock : public IWaitable
{
public:
SpinLock();
bool HasOSHandle(AuMach &mach) override;
bool HasLockImplementation() override;
bool Lock(AuUInt64 timeout) override;
bool TryLock() override;
void Lock() override;
void Unlock() override;
private:
AuAtomicInt value_;
};
AUKN_SHARED_API(SpinLock, SpinLock);
}