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
|
|
|
{
|
2021-10-08 19:51:34 +00:00
|
|
|
ConditionVariableImpl(const AuSPtr<IConditionMutex> &mutex);
|
2021-06-27 21:25:29 +00:00
|
|
|
~ConditionVariableImpl();
|
|
|
|
|
2021-10-08 19:51:34 +00:00
|
|
|
AuSPtr<IConditionMutex> GetMutex() override;
|
2021-06-27 21:25:29 +00:00
|
|
|
bool WaitForSignal(AuUInt32 timeout) override;
|
2023-03-15 00:35:29 +00:00
|
|
|
bool WaitForSignalNS(AuUInt64 timeout) override;
|
2021-06-27 21:25:29 +00:00
|
|
|
void Signal() override;
|
|
|
|
void Broadcast() override;
|
|
|
|
|
2023-03-12 15:27:28 +00:00
|
|
|
// TODO: ...
|
2021-06-27 21:25:29 +00:00
|
|
|
pthread_cond_t pthreadCv_;
|
2023-03-12 15:27:28 +00:00
|
|
|
private:
|
2021-10-08 19:51:34 +00:00
|
|
|
AuSPtr<IConditionMutexEx> mutex_;
|
2021-06-27 21:25:29 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|