2021-06-27 21:25:29 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
2023-03-12 15:27:28 +00:00
|
|
|
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;
|
2023-03-12 15:27:28 +00:00
|
|
|
bool LockNS(AuUInt64 timeout) override;
|
2021-06-27 21:25:29 +00:00
|
|
|
void Unlock() override;
|
|
|
|
|
|
|
|
private:
|
2023-03-15 00:35:29 +00:00
|
|
|
#if 0
|
2021-06-27 21:25:29 +00:00
|
|
|
SRWLOCK atomicHolder_;
|
|
|
|
CONDITION_VARIABLE wakeup_;
|
2023-03-15 00:35:29 +00:00
|
|
|
#endif
|
|
|
|
volatile AuUInt32 state_{};
|
2021-06-27 21:25:29 +00:00
|
|
|
};
|
|
|
|
}
|