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)
|
2023-03-15 00:35:29 +00:00
|
|
|
#include "AuConditionMutex.NT.hpp"
|
|
|
|
|
2021-06-27 21:25:29 +00:00
|
|
|
namespace Aurora::Threading::Primitives
|
|
|
|
{
|
2023-03-15 16:53:43 +00:00
|
|
|
struct ConditionVariableImpl final : IConditionVariable
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2021-10-08 19:51:34 +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);
|
2023-03-15 08:28:16 +00:00
|
|
|
|
2021-06-27 21:25:29 +00:00
|
|
|
private:
|
2023-03-16 18:25:23 +00:00
|
|
|
#if defined(AURORA_FORCE_SRW_LOCKS)
|
|
|
|
CONDITION_VARIABLE winCond_;
|
|
|
|
#else
|
2023-03-15 00:35:29 +00:00
|
|
|
AuUInt32 wlist {};
|
2023-03-15 08:28:16 +00:00
|
|
|
AuUInt32 signalCount {};
|
2023-03-16 18:25:23 +00:00
|
|
|
#endif
|
2023-03-16 19:24:05 +00:00
|
|
|
|
|
|
|
std::shared_ptr<Win32ConditionMutex> mutex_;
|
2021-06-27 21:25:29 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|