AuroraRuntime/Source/Threading/Primitives/ConditionVariable.Generic.hpp
Reece f559897b42 [+] Added WorkerId_t structure
[-] Removed WorkerId_t typedef
[*] Added shared support to some older threading apis that have yet to be updated
2021-10-08 20:51:34 +01:00

39 lines
1019 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: ConditionVariable.Generic.hpp
Date: 2021-6-14
Author: Reece
***/
#pragma once
#include "IConditionMutexEx.hpp"
#if defined(AURORA_IS_MODERNNT_DERIVED)
#include "ConditionVariable.NT.hpp"
#elif defined(AURORA_HAS_PTHREADS)
#include "ConditionVariable.Unix.hpp"
#else
#define _AURUNTIME_GENERICCV
#include "ConditionMutex.Generic.hpp"
namespace Aurora::Threading::Primitives
{
class ConditionVariableImpl : public IConditionVariable
{
public:
ConditionVariableImpl(const AuSPtr<IConditionMutex> &mutex);
AuSPtr<IConditionMutex> GetMutex() override;
bool WaitForSignal(AuUInt32 timeout) override;
void Signal() override;
void Broadcast() override;
private:
std::atomic_int signals_, waiting_;
AuSPtr<ConditionMutexImpl> mutex_;
};
}
#endif