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

30 lines
786 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.
2022-11-17 07:46:07 +00:00
File: AuConditionVariable.Unix.hpp
2021-06-27 21:25:29 +00:00
Date: 2021-6-12
Author: Reece
***/
#pragma once
#if !defined(_AURUNTIME_GENERICCV)
namespace Aurora::Threading::Primitives
{
2022-11-17 07:46:07 +00:00
struct ConditionVariableImpl : IConditionVariable
2021-06-27 21:25:29 +00:00
{
ConditionVariableImpl(const AuSPtr<IConditionMutex> &mutex);
2021-06-27 21:25:29 +00:00
~ConditionVariableImpl();
AuSPtr<IConditionMutex> GetMutex() override;
2021-06-27 21:25:29 +00:00
bool WaitForSignal(AuUInt32 timeout) override;
bool WaitForSignalNS(AuUInt64 timeout) override;
2021-06-27 21:25:29 +00:00
void Signal() override;
void Broadcast() override;
// TODO: ...
2021-06-27 21:25:29 +00:00
pthread_cond_t pthreadCv_;
private:
AuSPtr<IConditionMutexEx> mutex_;
2021-06-27 21:25:29 +00:00
};
}
#endif