AuroraRuntime/Source/IO/Loop/LSLocalSemaphore.hpp

46 lines
1.0 KiB
C++
Raw Normal View History

/***
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
2023-10-21 08:04:48 +00:00
File: LSLocalSemaphore.hpp
Date: 2023-10-21
Author: Reece
***/
#pragma once
#include "LSSemaphore.hpp"
namespace Aurora::IO::Loop
{
struct LSLocalSemaphore : LSSemaphore
{
LSLocalSemaphore();
~LSLocalSemaphore();
bool TryInit(AuUInt32 initialCount, AuUInt32 uMaxCount = 0);
bool IsSignaled() override;
2023-12-01 10:33:55 +00:00
bool IsSignaledNoSpinIfUserland() override;
ELoopSource GetType() override;
bool AddOne() override;
2024-03-21 00:28:50 +00:00
bool AddMany(AuUInt32 uCount) override;
virtual bool OnTrigger(AuUInt handle) override;
bool TryTakeNoSpin();
bool TryTakeSpin();
bool TryTake();
bool TryTakeWaitNS(AuUInt64 timeout);
PROXY_LOCAL_LOOPSOURCE_EXT_APIS_;
2023-10-21 17:12:23 +00:00
void OnPresleep() override;
void OnFinishSleep() override;
void DoParanoia();
AuAUInt32 uAtomicSemaphore {};
2023-10-22 05:11:39 +00:00
AuAUInt32 uAtomicKernelSemaphore {};
AuUInt32 uMaxCount {};
};
}