AuroraRuntime/Source/Async/GroupState.cpp

39 lines
879 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: GroupState.cpp
Date: 2021-11-1
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "Async.hpp"
#include "GroupState.hpp"
#include <Source/IO/Loop/LSAsync.hpp>
namespace Aurora::Async
{
bool GroupState::Init()
{
this->cvWorkMutex = AuThreadPrimitives::ConditionMutexUnique();
if (!this->cvWorkMutex)
{
return false;
}
this->cvVariable = AuThreadPrimitives::ConditionVariableUnique(AuUnsafeRaiiToShared(this->cvWorkMutex));
if (!this->cvVariable)
{
return false;
}
this->eventLs = AuLoop::NewLSAsync();
if (!this->eventLs)
{
return false;
}
this->asyncLoopSourceShared = this->eventLs;
return true;
}
}