AuroraRuntime/Source/Loop/WaitSingle.NT.cpp
Reece e5e36bd887 Large Commit
[*] Fix deadlock in the async subsystem (NoLockShutdown vs Shutdown in exception handler)
[+] Added ProccessMap NT variant
[+] Added ToolHelp image profiling
[*] Improved exception awareness
[*] Delegated SpawnThread to isolated TU, ready for reuse for RunAs and XNU Open - now with horrible evil alloc that could fail
[+] Added header for future api 'UtilRun'
[*] Improve NT core detection
[*] Changed small affinity bitmap to AuUInt64 instead of AuUInt32
[+] Added data structure to hold cpuids/affinity masks
[+] Implemented logger sinks
[+] Implemented logger glue logic
[*] Began migrating older loggers to sink-based default devices
[*] Minor refactors
[*] Improved internal exception discarding, not yet nothrow capable
[*] Minor create directory fix
2022-01-24 18:43:53 +00:00

51 lines
1.2 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: WaitSingle.NT.cpp
Date: 2021-10-1
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "WaitSingle.hpp"
namespace Aurora::Loop
{
bool WaitSingleGeneric::WaitForAtleastOne(const AuList<AuUInt> &handles, AuUInt &one)
{
if (handles.empty())
{
return {};
}
if (handles.size() == 1)
{
return WaitForSingleObjectEx(reinterpret_cast<HANDLE>(handles.at(0)), 0, true) == WAIT_OBJECT_0;
}
else
{
AuList<HANDLE> ntHandles;
ntHandles.reserve(handles.size());
for (const auto &handle : handles)
{
ntHandles.push_back(reinterpret_cast<HANDLE>(handle));
}
return WaitForMultipleObjectsEx(ntHandles.size(), ntHandles.data(), false, 0, true) >= WAIT_OBJECT_0;
}
}
void WaitSingleGeneric::OnPresleep()
{
}
void WaitSingleGeneric::OnFinishSleep()
{
}
ELoopSource WaitSingleGeneric::GetType()
{
return ELoopSource::eSourceInternalReserved1;
}
}