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

37 lines
926 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
AuSPtr<IConditionMutex> GetMutex() override;
2021-06-27 21:25:29 +00:00
bool WaitForSignal(AuUInt32 timeout) override;
bool WaitForSignalNS(AuUInt64 qwTimeout);
2021-06-27 21:25:29 +00:00
void Signal() override;
void Broadcast() override;
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
AuSPtr<Win32ConditionMutex> mutex_;
2021-06-27 21:25:29 +00:00
};
}
#endif