2021-11-05 17:34:23 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: GroupState.hpp
|
|
|
|
Date: 2021-11-1
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
#include "ThreadState.hpp"
|
|
|
|
|
|
|
|
namespace Aurora::Async
|
|
|
|
{
|
|
|
|
struct GroupState
|
|
|
|
{
|
|
|
|
ThreadGroup_t group;
|
|
|
|
|
|
|
|
AuThreadPrimitives::ConditionMutexUnique_t cvWorkMutex;
|
|
|
|
AuThreadPrimitives::ConditionVariableUnique_t cvVariable;
|
2022-06-11 23:52:46 +00:00
|
|
|
AuSPtr<AuLoop::ILSEvent> eventLs;
|
|
|
|
AuSPtr<AuLoop::ILoopSource> asyncLoopSourceShared;
|
2021-11-05 17:34:23 +00:00
|
|
|
|
|
|
|
AuList<WorkEntry_t> workQueue;
|
|
|
|
bool sorted {};
|
|
|
|
AuUInt32 dirty {};
|
|
|
|
|
|
|
|
AuBST<ThreadId_t, AuSPtr<ThreadState>> workers;
|
|
|
|
|
|
|
|
bool Init();
|
|
|
|
|
|
|
|
bool inline IsSysThread()
|
|
|
|
{
|
|
|
|
return group == 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|