Public release of the DLU server code!

Have fun!
This commit is contained in:
Unknown
2021-12-05 18:54:36 +01:00
parent 5f7270e4ad
commit 0545adfac3
1146 changed files with 368646 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
#include "InlineFunctor.h"
void InlineFunctor::HandleResult(bool wasCancelled, void *context)
{
ifp->Pop(callDepth);
}
InlineFunctorProcessor::InlineFunctorProcessor()
{
}
InlineFunctorProcessor::~InlineFunctorProcessor()
{
StopThreads(false);
}
void InlineFunctorProcessor::StartThreads(int numThreads)
{
functionThread.StartThreads(numThreads);
}
void InlineFunctorProcessor::StopThreads(bool blockOnCurrentProcessing)
{
functionThread.StopThreads(blockOnCurrentProcessing);
}
void InlineFunctorProcessor::YieldOnFunctor(InlineFunctor *inlineFunctor)
{
inlineFunctor->callDepth=GetCallDepth();
inlineFunctor->ifp=this;
functionThread.Push(inlineFunctor);
completedThreads.Push(false);
}
bool InlineFunctorProcessor::UpdateIFP(void)
{
functionThread.CallResultHandlers();
if (completedThreads.Size() && completedThreads[completedThreads.Size()-1]==true)
{
completedThreads.Pop();
return true;
}
return false;
}
void InlineFunctorProcessor::Pop(int threadCallDepth)
{
completedThreads[threadCallDepth]=true;
}
unsigned InlineFunctorProcessor::GetCallDepth(void) const
{
return completedThreads.Size();
}