36 lines
743 B
C++
36 lines
743 B
C++
|
/***
|
||
|
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||
|
|
||
|
File: LSLocalMutex.hpp
|
||
|
Date: 2023-10-21
|
||
|
Author: Reece
|
||
|
***/
|
||
|
#pragma once
|
||
|
|
||
|
#include "LSSemaphore.hpp"
|
||
|
|
||
|
namespace Aurora::IO::Loop
|
||
|
{
|
||
|
struct LSLocalMutex : LSSemaphore, ILSMutex
|
||
|
{
|
||
|
LSLocalMutex();
|
||
|
~LSLocalMutex();
|
||
|
|
||
|
bool TryInit();
|
||
|
|
||
|
bool IsSignaled() override;
|
||
|
bool WaitOn(AuUInt32 timeout) override;
|
||
|
ELoopSource GetType() override;
|
||
|
|
||
|
bool Unlock() override;
|
||
|
|
||
|
virtual bool OnTrigger(AuUInt handle) override;
|
||
|
|
||
|
bool TryTakeNoSpin();
|
||
|
bool TryTakeSpin();
|
||
|
bool TryTake();
|
||
|
bool TryTakeWaitMS(AuUInt32 timeout);
|
||
|
|
||
|
AuAUInt32 uAtomicWord {};
|
||
|
};
|
||
|
}
|