AuroraRuntime/Source/IO/CompletionGroup/CompletionGroupLoopSource.hpp

35 lines
1.2 KiB
C++

/***
Copyright (C) 2023 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: CompletionGroupLoopSource.hpp
Date: 2023-12-28
Author: Reece
***/
#pragma once
#include <Source/IO/Loop/LSLocalEvent.hpp>
#include <Source/IO/Loop/LSEvent.hpp>
namespace Aurora::IO::CompletionGroup
{
struct CompletionGroupLoopSource :
Loop::LSEvent
// Loop::LSLocalEvent -> not going to work on NT. ugh
// Nt is going to expect event handles...
// ...outside of XPs dumb-fuck SignalAndWait api because nobody at msft knew how to implement a condvar, every other IO subsystem is documented to expect event handles, not semaphore kernel objects.
// linshid: we always use eventfd
// posix: we could always fallback on pipe fds
// bsd: doesnt matter so long as the kqueue supplier for loopqueues is in place
{
CompletionGroupLoopSource(CompletionGroup *pParent, bool bAnd);
bool DoInit(bool bSignaledAlready);
bool IsSignaled() override;
bool OnTrigger(AuUInt handle) override;
Loop::ELoopSource GetType() override;
CompletionGroup *pParent;
bool bIsAnd {};
};
}