2021-06-27 21:25:29 +00:00
|
|
|
/***
|
|
|
|
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
|
|
|
|
{
|
|
|
|
/**
|
2022-06-29 13:56:59 +00:00
|
|
|
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.
|
2021-06-27 21:25:29 +00:00
|
|
|
*/
|
2022-06-01 21:49:38 +00:00
|
|
|
struct IConditionMutex
|
2021-06-27 21:25:29 +00:00
|
|
|
{
|
2023-01-30 13:26:17 +00:00
|
|
|
virtual bool TryLock() = 0;
|
2021-06-27 21:25:29 +00:00
|
|
|
virtual void Lock() = 0;
|
|
|
|
virtual void Unlock() = 0;
|
|
|
|
};
|
|
|
|
|
2023-03-21 03:18:09 +00:00
|
|
|
AUKN_SHARED_SOO(ConditionMutex, IConditionMutex, kPrimitiveSizeCondMutex);
|
2021-06-27 21:25:29 +00:00
|
|
|
}
|