![]() |
Ark Server API (ASA) - Wiki
|
#include <QueuedThreadPoolWrapper.h>
Inheritance diagram for FQueuedThreadPoolWrapper:
Collaboration diagram for FQueuedThreadPoolWrapper:Classes | |
| class | FScheduledWork |
Public Member Functions | |
| 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 () |
Protected Member Functions | |
| virtual int32 | GetMaxConcurrency () const |
| virtual void | OnScheduled (const IQueuedWork *) |
| virtual void | OnUnscheduled (const IQueuedWork *) |
| virtual FScheduledWork * | AllocateScheduledWork () |
Protected Attributes | |
| FCriticalSection | Lock |
| FThreadPoolPriorityQueue | QueuedWork |
Private Member Functions | |
| FScheduledWork * | AllocateWork (IQueuedWork *InnerWork, EQueuedWorkPriority Priority) |
| bool | CanSchedule (EQueuedWorkPriority Priority) const |
| bool | Create (uint32 InNumQueuedThreads, uint32 StackSize, EThreadPriority ThreadPriority, const TCHAR *Name) override |
| void | Destroy () override |
| void | Schedule (FScheduledWork *Work=nullptr) |
| void | ReleaseWorkNoLock (FScheduledWork *Work) |
| bool | TryRetractWorkNoLock (EQueuedWorkPriority InPriority) |
Private Attributes | |
| TFunction< EQueuedWorkPriority(EQueuedWorkPriority)> | PriorityMapper |
| FQueuedThreadPool * | WrappedQueuedThreadPool |
| TArray< FScheduledWork * > | WorkPool |
| TMap< IQueuedWork *, FScheduledWork * > | ScheduledWork |
| std::atomic< int32 > | MaxConcurrency |
| int32 | MaxTaskToSchedule |
| std::atomic< int32 > | CurrentConcurrency |
| EQueuedWorkPriority | WrappedQueuePriority |
| bool | bIsScheduling = false |
Additional Inherited Members | |
Static Public Member Functions inherited from FQueuedThreadPool | |
| static FQueuedThreadPool * | Allocate () |
Static Public Attributes inherited from FQueuedThreadPool | |
| static uint32 | OverrideStackSize |
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 effectively giving another set of priorities.
Definition at line 40 of file QueuedThreadPoolWrapper.h.
| FQueuedThreadPoolWrapper::FQueuedThreadPoolWrapper | ( | FQueuedThreadPool * | InWrappedQueuedThreadPool, |
| int32 | InMaxConcurrency = -1, | ||
| TFunction< EQueuedWorkPriority(EQueuedWorkPriority)> | InPriorityMapper = [](EQueuedWorkPriority InPriority) { return InPriority;} ) |
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.
| FQueuedThreadPoolWrapper::~FQueuedThreadPoolWrapper | ( | ) |
|
overridevirtual |
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.
| InQueuedWork | The work that needs to be done asynchronously |
| InQueuedWorkPriority | The priority at which to process this task |
Implements FQueuedThreadPool.
Here is the caller graph for this function:
|
inlineprotectedvirtual |
|
private |
|
private |
|
overrideprivatevirtual |
Creates the thread pool with the specified number of threads
| InNumQueuedThreads | Specifies the number of threads to use in the pool |
| StackSize | The size of stack the threads in the pool need (32K default) |
| ThreadPriority | priority of new pool thread |
| Name | optional name for the pool to be used for instrumentation |
Implements FQueuedThreadPool.
|
overrideprivatevirtual |
Tells the pool to clean up all background threads
Implements FQueuedThreadPool.
|
inline |
Definition at line 69 of file QueuedThreadPoolWrapper.h.
Definition at line 178 of file QueuedThreadPoolWrapper.h.
|
overridevirtual |
Get the number of queued threads
Implements FQueuedThreadPool.
|
inlineprotectedvirtual |
Definition at line 181 of file QueuedThreadPoolWrapper.h.
|
inlineprotectedvirtual |
Definition at line 184 of file QueuedThreadPoolWrapper.h.
| void FQueuedThreadPoolWrapper::Pause | ( | ) |
Queued task are not scheduled against the wrapped thread-pool until resumed
|
private |
Resume a specified amount of queued work, or -1 to unpause.
|
overridevirtual |
Attempts to retract a previously queued task.
| InQueuedWork | The work to try to retract |
Implements FQueuedThreadPool.
|
private |
Here is the caller graph for this function:Dynamically adjust the maximum number of concurrent tasks, -1 for unlimited.
|
private |
Definition at line 206 of file QueuedThreadPoolWrapper.h.
|
private |
Definition at line 204 of file QueuedThreadPoolWrapper.h.
|
protected |
Definition at line 174 of file QueuedThreadPoolWrapper.h.
|
private |
Definition at line 202 of file QueuedThreadPoolWrapper.h.
|
private |
Definition at line 203 of file QueuedThreadPoolWrapper.h.
|
private |
Definition at line 197 of file QueuedThreadPoolWrapper.h.
|
protected |
Definition at line 175 of file QueuedThreadPoolWrapper.h.
|
private |
Definition at line 201 of file QueuedThreadPoolWrapper.h.
|
private |
Definition at line 200 of file QueuedThreadPoolWrapper.h.
|
private |
Definition at line 199 of file QueuedThreadPoolWrapper.h.
|
private |
Definition at line 205 of file QueuedThreadPoolWrapper.h.