2023-10-21 08:04:48 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: LSLocalEvent.hpp
|
|
|
|
Date: 2023-10-21
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "LSSemaphore.hpp"
|
|
|
|
|
|
|
|
namespace Aurora::IO::Loop
|
|
|
|
{
|
|
|
|
struct LSLocalEvent : LSSemaphore, ILSEvent
|
|
|
|
{
|
|
|
|
LSLocalEvent();
|
|
|
|
~LSLocalEvent();
|
|
|
|
|
|
|
|
bool TryInit(bool bTriggered, bool bAtomicRelease, bool bPermitMultipleTriggers);
|
|
|
|
|
2023-12-28 16:49:11 +00:00
|
|
|
virtual bool IsSignaled() override;
|
2023-10-21 08:04:48 +00:00
|
|
|
ELoopSource GetType() override;
|
|
|
|
|
|
|
|
bool Set() override;
|
|
|
|
bool Reset() override;
|
|
|
|
|
|
|
|
virtual bool OnTrigger(AuUInt handle) override;
|
|
|
|
|
|
|
|
bool TryTakeNoSpin();
|
|
|
|
bool TryTakeSpin();
|
|
|
|
bool TryTake();
|
2024-09-07 21:45:34 +00:00
|
|
|
bool TryTakeWaitNS(AuUInt64 timeout);
|
|
|
|
|
|
|
|
PROXY_LOCAL_LOOPSOURCE_EXT_APIS_;
|
|
|
|
|
2023-12-01 10:33:55 +00:00
|
|
|
bool IsSignaledNoSpinIfUserland() override;
|
2023-10-21 08:04:48 +00:00
|
|
|
void OnPresleep() override;
|
|
|
|
void OnFinishSleep() override;
|
|
|
|
|
|
|
|
union EventBits
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
AuUInt8 bAtomicRelease : 1;
|
|
|
|
AuUInt8 bPermitMultipleTriggers : 1;
|
|
|
|
AuUInt8 bTriggered : 1;
|
|
|
|
};
|
|
|
|
AuUInt32 state;
|
|
|
|
};
|
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
AuUInt8 bAtomicRelease_ : 1;
|
|
|
|
AuUInt8 bPermitMultipleTriggers_ : 1;
|
|
|
|
AuUInt8 bTriggered_ : 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
AuUInt32 state_;
|
|
|
|
};
|
|
|
|
|
2023-10-21 12:12:58 +00:00
|
|
|
AuUInt32 uApproxSleepCount {};
|
2023-12-09 10:05:20 +00:00
|
|
|
AuUInt32 uLaterAlwaysOn {};
|
2023-10-21 08:04:48 +00:00
|
|
|
};
|
|
|
|
}
|