AuroraRuntime/Source/IO/Loop/LSSemaphore.Linux.hpp

38 lines
938 B
C++
Raw Normal View History

2022-04-05 05:59:23 +00:00
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSSemaphore.Linux.hpp
Date: 2022-4-5
Author: Reece
***/
#pragma once
#include "LSHandle.hpp"
namespace Aurora::IO::Loop
{
struct LSSemaphore : ILSSemaphore, virtual LSHandle
2022-04-05 05:59:23 +00:00
{
2023-10-21 03:31:00 +00:00
LSSemaphore();
2022-04-05 05:59:23 +00:00
LSSemaphore(AuUInt32 initialCount);
LSSemaphore(int handle, int tag);
~LSSemaphore();
2022-04-05 05:59:23 +00:00
PROXY_LOOP_LOOPSOURCE_EXT_WAIT_APIS_;
2023-10-21 03:31:00 +00:00
bool TryInit(AuUInt32 initialCount = 0);
2022-04-05 05:59:23 +00:00
bool AddOne() override;
2023-10-22 05:11:39 +00:00
bool AddMany(AuUInt32 uCount) override;
2022-04-05 05:59:23 +00:00
virtual bool OnTrigger(AuUInt handle) override;
bool IsSignaled() override;
bool IsSignaledExt(AuUInt8 uFlags) override;
bool WaitOn(AuUInt32 timeout) override;
2022-04-05 05:59:23 +00:00
virtual ELoopSource GetType() override;
private:
void Init(AuUInt32 initialCount);
bool IsSignaledNonblocking();
};
}