Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FQueuedThreadPoolDynamicWrapper Class Reference

#include <QueuedThreadPoolWrapper.h>

+ Inheritance diagram for FQueuedThreadPoolDynamicWrapper:
+ Collaboration diagram for FQueuedThreadPoolDynamicWrapper:

Public Member Functions

 FQueuedThreadPoolDynamicWrapper (FQueuedThreadPool *InWrappedQueuedThreadPool, int32 InMaxConcurrency=-1, TFunction< EQueuedWorkPriority(EQueuedWorkPriority)> InPriorityMapper=[](EQueuedWorkPriority InPriority) { return InPriority;})
 
void AddQueuedWork (IQueuedWork *InQueuedWork, EQueuedWorkPriority InPriority=EQueuedWorkPriority::Normal) override
 
void Sort (TFunctionRef< bool(const IQueuedWork *Lhs, const IQueuedWork *Rhs)> Predicate)
 
- Public Member Functions inherited from FQueuedThreadPoolWrapper
 FQueuedThreadPoolWrapper (FQueuedThreadPool *InWrappedQueuedThreadPool, int32 InMaxConcurrency=-1, TFunction< EQueuedWorkPriority(EQueuedWorkPriority)> InPriorityMapper=[](EQueuedWorkPriority InPriority) { return InPriority;})
 
 ~FQueuedThreadPoolWrapper ()
 
void Pause ()
 
void Resume (int32 InNumQueuedWork=-1)
 
void SetMaxConcurrency (int32 MaxConcurrency=-1)
 
void AddQueuedWork (IQueuedWork *InQueuedWork, EQueuedWorkPriority InPriority=EQueuedWorkPriority::Normal) override
 
bool RetractQueuedWork (IQueuedWork *InQueuedWork) override
 
int32 GetNumThreads () const override
 
int32 GetCurrentConcurrency () const
 
- Public Member Functions inherited from FQueuedThreadPool
 FQueuedThreadPool ()
 
virtual ~FQueuedThreadPool ()
 

Additional Inherited Members

- Static Public Member Functions inherited from FQueuedThreadPool
static FQueuedThreadPoolAllocate ()
 
- Static Public Attributes inherited from FQueuedThreadPool
static uint32 OverrideStackSize
 
- Protected Member Functions inherited from FQueuedThreadPoolWrapper
virtual int32 GetMaxConcurrency () const
 
virtual void OnScheduled (const IQueuedWork *)
 
virtual void OnUnscheduled (const IQueuedWork *)
 
virtual FScheduledWorkAllocateScheduledWork ()
 
- Protected Attributes inherited from FQueuedThreadPoolWrapper
FCriticalSection Lock
 
FThreadPoolPriorityQueue QueuedWork
 

Detailed Description

ThreadPool wrapper implementation allowing to schedule up to MaxConcurrency tasks at a time making sub-partitioning another thread-pool a breeze and allowing more fine-grained control over scheduling by giving full control of task reordering.

Definition at line 214 of file QueuedThreadPoolWrapper.h.

Constructor & Destructor Documentation

◆ FQueuedThreadPoolDynamicWrapper()

FQueuedThreadPoolDynamicWrapper::FQueuedThreadPoolDynamicWrapper ( FQueuedThreadPool * InWrappedQueuedThreadPool,
int32 InMaxConcurrency = -1,
TFunction< EQueuedWorkPriority(EQueuedWorkPriority)> InPriorityMapper = [](EQueuedWorkPriority InPriority) { return InPriority; } )
inline

InWrappedQueuedThreadPool Underlying thread pool to schedule task to. InMaxConcurrency Maximum number of concurrent tasks allowed, -1 will limit concurrency to number of threads available in the underlying thread pool. InPriorityMapper Thread-safe function used to map any priority from this Queue to the priority that should be used when scheduling the task on the underlying thread pool.

Definition at line 222 of file QueuedThreadPoolWrapper.h.

Member Function Documentation

◆ AddQueuedWork()

void FQueuedThreadPoolDynamicWrapper::AddQueuedWork ( IQueuedWork * InQueuedWork,
EQueuedWorkPriority InQueuedWorkPriority = EQueuedWorkPriority::Normal )
inlineoverridevirtual

Checks to see if there is a thread available to perform the task. If not, it queues the work for later. Otherwise it is immediately dispatched.

Parameters
InQueuedWorkThe work that needs to be done asynchronously
InQueuedWorkPriorityThe priority at which to process this task
See also
RetractQueuedWork

Implements FQueuedThreadPool.

Definition at line 227 of file QueuedThreadPoolWrapper.h.

+ Here is the call graph for this function:

◆ Sort()

void FQueuedThreadPoolDynamicWrapper::Sort ( TFunctionRef< bool(const IQueuedWork *Lhs, const IQueuedWork *Rhs)> Predicate)
inline

Apply sort predicate to reorder the queued tasks

Definition at line 236 of file QueuedThreadPoolWrapper.h.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: