mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Public release of the DLU server code!
Have fun!
This commit is contained in:
49
thirdparty/raknet/Source/InlineFunctor.cpp
vendored
Normal file
49
thirdparty/raknet/Source/InlineFunctor.cpp
vendored
Normal 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();
|
||||
}
|
Reference in New Issue
Block a user