AuroraRuntime/Source/Threading/Primitives/AuConditionVariable.NT.hpp
2023-03-22 16:59:21 +00:00

38 lines
971 B
C++

/***
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"
namespace Aurora::Threading::Primitives
{
struct ConditionVariableImpl final : IConditionVariable
{
ConditionVariableImpl(const AuSPtr<IConditionMutex> &mutex);
auline AuSPtr<IConditionMutex> GetMutex() override;
auline bool WaitForSignal(AuUInt32 timeout) override;
bool WaitForSignalNS(AuUInt64 qwTimeout);
auline void Signal() override;
auline void Broadcast() override;
auline bool CheckOut(bool &bRet);
private:
#if defined(AURORA_FORCE_SRW_LOCKS)
CONDITION_VARIABLE winCond_;
#else
AuUInt32 wlist {};
AuUInt32 signalCount {};
#endif
std::shared_ptr<Win32ConditionMutex> mutex_;
};
}
#endif