AuroraRuntime/Source/IO/Loop/LSWin32.NT.cpp

42 lines
1005 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: LSWin32.NT.cpp
Date: 2021-10-2
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "LSWin32.NT.hpp"
namespace Aurora::IO::Loop
{
bool Win32Dummy::IsSignaled()
{
MSG askers;
return PeekMessageW(&askers, 0, 0, 0, PM_NOREMOVE);
}
bool Win32Dummy::WaitOn(AuUInt32 timeout)
{
// TODO: Close
static HANDLE kAlwaysOffMutex = CreateEventW(nullptr, true, false, nullptr);
return MsgWaitForMultipleObjects(0, &kAlwaysOffMutex, false, timeout ? timeout : INFINITE, QS_ALLEVENTS) == WAIT_OBJECT_0 + 1;
}
ELoopSource Win32Dummy::GetType()
{
return ELoopSource::eSourceWin32;
}
AUKN_SYM AuSPtr<ILoopSource> NewLSWin32Source(bool pumping)
{
AuSPtr<ILoopSource> ret;
if (!(ret = AuMakeShared<Win32Dummy>(pumping)))
{
return {};
}
return ret;
}
}