AuroraRuntime/Source/IO/Loop/LSEvent.NT.cpp
Reece 7fde7d04fb [+] EPipeCallbackType
[+] IIOBufferedStreamAvailable callback
[+] IIOProcessor singleshot work items / IIOProcessorWorkUnit
[+] IOPipeCallback description of a pipes destination
[+] IOPipeInputData description of a pipes source
[+] IOPipeRequest, IOPipeRequestAIO, IOPipeRequestBasic
[+] IPipeBackend hooks for on start/end hooks of IOPipeRequestBasics
[*] Update IOAdapaterAsyncStream implementation to better support caller buffering
[*] Updated IAsyncStreamReader to include a warm/dequeue API for direct async usage
[*] Fix NT IO regressions
[*] Fix ThreadPool shutdown on an unregistered thread
[*] Fix race condition in Async.NT.cpp & fix signalable state to closely match Linux (dunno how this was passing before)
[*] Refactor IOProcessorWorkUnit -> IIOProcessorWorkUnit
[*] Update experimental header to include the changes
2022-06-21 05:49:36 +01:00

73 lines
1.6 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSEvent.NT.cpp
Date: 2021-10-1
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "LSEvent.hpp"
namespace Aurora::IO::Loop
{
LSEvent::LSEvent(HANDLE h) : LSHandle(AuUInt(h))
{
}
LSEvent::LSEvent(bool triggered, bool atomicRelease, bool permitMultipleTriggers) //:
//LSHandle((AuUInt)::CreateEventW(NULL, !atomicRelease, triggered, NULL))
{
// WTF?
this->UpdateReadHandle((AuUInt)::CreateEventW(NULL, !atomicRelease, triggered, NULL));
}
LSEvent::~LSEvent()
{
auto handle = reinterpret_cast<HANDLE>(this->handle);
AuWin32CloseHandle(handle);
this->handle = kInvalidHandle;
}
bool LSEvent::Set()
{
return ::SetEvent(reinterpret_cast<HANDLE>(this->handle));
}
bool LSEvent::Reset()
{
return ::ResetEvent(reinterpret_cast<HANDLE>(this->handle));
}
bool LSEvent::IsSignaled()
{
return LSHandle::IsSignaled();
}
bool LSEvent::WaitOn(AuUInt32 timeout)
{
return LSHandle::WaitOn(timeout);
}
ELoopSource LSEvent::GetType()
{
return ELoopSource::eSourceEvent;
}
AUKN_SYM AuSPtr<ILSEvent> NewLSEvent(bool triggerd, bool atomicRelease, bool permitMultipleTriggers)
{
AuSPtr<LSEvent> ret;
if (!(ret = AuMakeShared<LSEvent>(triggerd, atomicRelease, permitMultipleTriggers)))
{
return {};
}
if (!ret->HasValidHandle())
{
return {};
}
return ret;
}
}