AuroraRuntime/Source/Loop/WaitSingleBase.cpp

42 lines
898 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: WaitSingle.Generic.cpp
Date: 2021-10-2
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "WaitSingleBase.hpp"
namespace Aurora::Loop
{
bool WaitSingleBase::IsSignaled()
{
bool val {};
AuUInt one {};
this->OnPresleep();
if (this->Singular())
{
auto handle = this->GetHandle();
auto val = this->WaitForOne(handle);
if (val)
{
val = this->OnTrigger(handle);
}
}
else
{
auto handles = this->GetHandles();
auto val = WaitForAtleastOne(handles, one);
if (val)
{
val = this->OnTrigger(one);
}
}
this->OnFinishSleep();
return val;
}
}