AuroraRuntime/Source/Loop/LSHandle.hpp

48 lines
1.2 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSHandle.hpp
Date: 2021-10-1
Author: Reece
***/
#pragma once
#include "WaitSingle.hpp"
namespace Aurora::Loop
{
#if defined(AURORA_IS_MODERNNT_DERIVED)
static constexpr auto kInvalidHandle = INVALID_HANDLE_VALUE;
#else
static constexpr auto kInvalidHandle = -1;
#endif
struct LSHandle : public WaitSingleGeneric
{
LSHandle();
LSHandle(AuUInt handle);
LSHandle(AuUInt handleRd, AuUInt handleWr);
virtual bool OnTrigger(AuUInt handle) override;
virtual AuList<AuUInt> GetHandles() override;
virtual AuUInt GetHandle() override;
virtual bool Singular() override;
#if defined(AURORA_IS_POSIX_DERIVED)
virtual AuList<AuUInt> GetWriteHandles() override;
virtual AuUInt GetWriteHandle() override;
void UpdateWriteHandle(AuUInt handle);
#endif
virtual ELoopSource GetType() override;
bool HasValidHandle();
void UpdateReadHandle(AuUInt handle);
protected:
AuUInt handle {kInvalidHandle};
#if defined(AURORA_IS_POSIX_DERIVED)
AuUInt handleWr {kInvalidHandle};
#endif
};
}