AuroraRuntime/Source/Threading/Primitives/AuMutex.NT.hpp

32 lines
708 B
C++
Raw Normal View History

2021-06-27 21:25:29 +00:00
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuMutex.NT.hpp
2021-06-27 21:25:29 +00:00
Date: 2021-6-12
Author: Reece
***/
#pragma once
namespace Aurora::Threading::Primitives
{
2022-06-01 21:49:38 +00:00
struct Mutex : IWaitable
2021-06-27 21:25:29 +00:00
{
Mutex();
~Mutex();
bool HasOSHandle(AuMach &mach) override;
bool TryLock() override;
bool HasLockImplementation() override;
void Lock() override;
bool Lock(AuUInt64 timeout) override;
bool LockNS(AuUInt64 timeout) override;
2021-06-27 21:25:29 +00:00
void Unlock() override;
private:
#if 0
2021-06-27 21:25:29 +00:00
SRWLOCK atomicHolder_;
CONDITION_VARIABLE wakeup_;
#endif
volatile AuUInt32 state_{};
2021-06-27 21:25:29 +00:00
};
}