AuroraRuntime/Include/Aurora/Threading/Primitives/ConditionMutex.hpp

25 lines
690 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: ConditionMutex.hpp
Date: 2021-6-9
Author: Reece
***/
#pragma once
namespace Aurora::Threading::Primitives
{
/**
A limited mutex specifically for condition variables.
This should be used with the traditional CV idiom of `lock(), while(cond) { cv.wait() }, unlock()`.
For other use cases, you should use the alternative mutex.
*/
struct IConditionMutex
{
virtual bool TryLock() = 0;
virtual void Lock() = 0;
virtual void Unlock() = 0;
};
AUKN_SHARED_SOO_NCM(ConditionMutex, IConditionMutex, kPrimitiveSizeCondMutex);
}