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

38 lines
971 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: ConditionVariable.Win32.hpp
Date: 2021-6-12
Author: Reece
***/
#pragma once
#if !defined(_AURUNTIME_GENERICCV)
#include "AuConditionMutex.NT.hpp"
2021-06-27 21:25:29 +00:00
namespace Aurora::Threading::Primitives
{
struct ConditionVariableImpl final : IConditionVariable
2021-06-27 21:25:29 +00:00
{
ConditionVariableImpl(const AuSPtr<IConditionMutex> &mutex);
2021-06-27 21:25:29 +00:00
2023-03-22 13:42:07 +00:00
auline AuSPtr<IConditionMutex> GetMutex() override;
auline bool WaitForSignal(AuUInt32 timeout) override;
2023-03-22 16:59:21 +00:00
bool WaitForSignalNS(AuUInt64 qwTimeout);
2023-03-22 13:42:07 +00:00
auline void Signal() override;
auline void Broadcast() override;
2021-06-27 21:25:29 +00:00
2023-03-22 13:42:07 +00:00
auline bool CheckOut(bool &bRet);
2021-06-27 21:25:29 +00:00
private:
#if defined(AURORA_FORCE_SRW_LOCKS)
CONDITION_VARIABLE winCond_;
#else
AuUInt32 wlist {};
AuUInt32 signalCount {};
#endif
std::shared_ptr<Win32ConditionMutex> mutex_;
2021-06-27 21:25:29 +00:00
};
}
#endif