38 lines
1.6 KiB
C++
38 lines
1.6 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: ConditionEx.hpp
|
|
Date: 2021-6-11
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
namespace Aurora::Threading::Primitives
|
|
{
|
|
/**
|
|
A more comprehensive CV that does not strictly abide by the alternative stricter assumptions.
|
|
This object depends on the synchronization of primitives within our abstraction layer rather than
|
|
the OS's implementation of condition variables.
|
|
In some instances, the cond mutex/var implementations are directly backed by an OS primitive,
|
|
sometimes they're reimplemented. In this primitive any locking interface can be used, and an
|
|
AuThreadPrimitive is used for the sleep operation.
|
|
Note: Missing 'pWaitable's cannnot serve as an `atomic wait for while is [not] value` operation.
|
|
There are no legal use cases for this feature. It's just there.
|
|
*/
|
|
struct IFlexibleConditionVariable
|
|
{
|
|
virtual void WaitForSignal() = 0;
|
|
virtual void WaitForSignal(IWaitable *pWaitable) = 0;
|
|
|
|
virtual bool WaitForSignalNS(AuUInt64 uRelativeNanoseconds) = 0;
|
|
virtual bool WaitForSignalNS(IWaitable *pWaitable, AuUInt64 uRelativeNanoseconds) = 0;
|
|
|
|
virtual bool WaitForSignalAbsNS(AuUInt64 uAbsNanoseconds) = 0;
|
|
virtual bool WaitForSignalAbsNS(IWaitable *pWaitable, AuUInt64 uAbsNanoseconds) = 0;
|
|
|
|
virtual void Broadcast() = 0;
|
|
virtual void Signal() = 0;
|
|
};
|
|
|
|
AUKN_SHARED_SOO_NCM(FlexibleConditionVariable, IFlexibleConditionVariable, kPrimitiveSizeSemaphoreCV);
|
|
} |