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

40 lines
895 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: AuConditionMutex.NT.hpp
2021-06-27 21:25:29 +00:00
Date: 2021-6-12
Author: Reece
***/
#pragma once
2022-11-17 07:46:07 +00:00
#include "AuIConditionMutexEx.hpp"
2021-06-27 21:25:29 +00:00
#if !defined(_AURUNTIME_GENERICCM)
namespace Aurora::Threading::Primitives
{
#define FAST_M_WAKE 256u
#define FAST_M_WAIT 512u
inline HANDLE gKeyedEventHandle { INVALID_HANDLE_VALUE };
struct NT4Mutex
{
AuUInt32 uWaitCount {}; // yields while bits are high, dec to release one from the semaphore yield
};
2022-06-01 21:49:38 +00:00
struct Win32ConditionMutex : IConditionMutexEx
2021-06-27 21:25:29 +00:00
{
Win32ConditionMutex();
~Win32ConditionMutex();
bool TryLock() override;
2021-06-27 21:25:29 +00:00
void Lock() override;
void Unlock() override;
AuUInt GetOSHandle() override;
NT4Mutex lock_;
2021-06-27 21:25:29 +00:00
};
using ConditionMutexImpl = Win32ConditionMutex;
}
#endif