Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FQueuedLowLevelThreadPool Class Referencefinal

#include <QueuedThreadPoolWrapper.h>

+ Inheritance diagram for FQueuedLowLevelThreadPool:
+ Collaboration diagram for FQueuedLowLevelThreadPool:

Classes

struct  FQueuedWorkInternalData
 

Public Member Functions

 FQueuedLowLevelThreadPool (TFunction< EQueuedWorkPriority(EQueuedWorkPriority)> InPriorityMapper=[](EQueuedWorkPriority InPriority) { return InPriority;}, LowLevelTasks::FScheduler *InScheduler=&LowLevelTasks::FScheduler::Get())
 
 ~FQueuedLowLevelThreadPool ()
 
voidoperator new (size_t size)
 
void operator delete (void *ptr)
 
void Pause ()
 
void Resume (int32 InNumQueuedWork=-1)
 
- Public Member Functions inherited from FQueuedThreadPool
 FQueuedThreadPool ()
 
virtual ~FQueuedThreadPool ()
 

Protected Member Functions

bool Create (uint32 InNumQueuedThreads, uint32 InStackSize, EThreadPriority InThreadPriority, const TCHAR *InName) override
 
void Destroy () override
 

Private Member Functions

void ScheduleTasks (bool &bWakeUpWorker)
 
void FinalizeExecution ()
 
void AddQueuedWork (IQueuedWork *InQueuedWork, EQueuedWorkPriority InPriority=EQueuedWorkPriority::Normal) override
 
bool RetractQueuedWork (IQueuedWork *InQueuedWork) override
 
int32 GetNumThreads () const override
 
FQueuedWorkInternalDataDequeue ()
 
void Enqueue (EQueuedWorkPriority Priority, FQueuedWorkInternalData *Item)
 

Private Attributes

FAAArrayQueue< FQueuedWorkInternalDataPendingWork [int32(EQueuedWorkPriority::Count)]
 
LowLevelTasks::FSchedulerScheduler = nullptr
 
TFunction< EQueuedWorkPriority(EQueuedWorkPriority)> PriorityMapper
 
std::atomic_uint TaskCount {0}
 
std::atomic_bool bIsExiting {false}
 
std::atomic_bool bIsPaused {false}
 

Additional Inherited Members

- Static Public Member Functions inherited from FQueuedThreadPool
static FQueuedThreadPoolAllocate ()
 
- Static Public Attributes inherited from FQueuedThreadPool
static uint32 OverrideStackSize
 

Detailed Description

ThreadPool wrapper implementation allowing to schedule thread-pool tasks on the the low level backend which is also used by the taskgraph.

Definition at line 356 of file QueuedThreadPoolWrapper.h.

Constructor & Destructor Documentation

◆ FQueuedLowLevelThreadPool()

FQueuedLowLevelThreadPool::FQueuedLowLevelThreadPool ( TFunction< EQueuedWorkPriority(EQueuedWorkPriority)> InPriorityMapper = [](EQueuedWorkPriority InPriority) { return InPriority; },
LowLevelTasks::FScheduler * InScheduler = &LowLevelTasks::FScheduler::Get() )
inline

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 372 of file QueuedThreadPoolWrapper.h.

◆ ~FQueuedLowLevelThreadPool()

FQueuedLowLevelThreadPool::~FQueuedLowLevelThreadPool ( )
inline

Definition at line 377 of file QueuedThreadPoolWrapper.h.

+ Here is the call graph for this function:

Member Function Documentation

◆ AddQueuedWork()

void FQueuedLowLevelThreadPool::AddQueuedWork ( IQueuedWork * InQueuedWork,
EQueuedWorkPriority InQueuedWorkPriority = EQueuedWorkPriority::Normal )
inlineoverrideprivatevirtual

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 452 of file QueuedThreadPoolWrapper.h.

+ Here is the call graph for this function:

◆ Create()

bool FQueuedLowLevelThreadPool::Create ( uint32 InNumQueuedThreads,
uint32 StackSize,
EThreadPriority ThreadPriority,
const TCHAR * Name )
inlineoverrideprotectedvirtual

Creates the thread pool with the specified number of threads

Parameters
InNumQueuedThreadsSpecifies the number of threads to use in the pool
StackSizeThe size of stack the threads in the pool need (32K default)
ThreadPrioritypriority of new pool thread
Nameoptional name for the pool to be used for instrumentation
Returns
Whether the pool creation was successful or not

Implements FQueuedThreadPool.

Definition at line 501 of file QueuedThreadPoolWrapper.h.

◆ Dequeue()

FQueuedWorkInternalData * FQueuedLowLevelThreadPool::Dequeue ( )
inlineprivate

Definition at line 539 of file QueuedThreadPoolWrapper.h.

+ Here is the caller graph for this function:

◆ Destroy()

void FQueuedLowLevelThreadPool::Destroy ( )
inlineoverrideprotectedvirtual

Tells the pool to clean up all background threads

Implements FQueuedThreadPool.

Definition at line 506 of file QueuedThreadPoolWrapper.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Enqueue()

void FQueuedLowLevelThreadPool::Enqueue ( EQueuedWorkPriority Priority,
FQueuedWorkInternalData * Item )
inlineprivate

Definition at line 552 of file QueuedThreadPoolWrapper.h.

+ Here is the caller graph for this function:

◆ FinalizeExecution()

void FQueuedLowLevelThreadPool::FinalizeExecution ( )
inlineprivate

Definition at line 445 of file QueuedThreadPoolWrapper.h.

+ Here is the call graph for this function:

◆ GetNumThreads()

int32 FQueuedLowLevelThreadPool::GetNumThreads ( ) const
inlineoverrideprivatevirtual

Get the number of queued threads

Implements FQueuedThreadPool.

Definition at line 495 of file QueuedThreadPoolWrapper.h.

◆ operator delete()

void FQueuedLowLevelThreadPool::operator delete ( void * ptr)
inline

Definition at line 387 of file QueuedThreadPoolWrapper.h.

+ Here is the call graph for this function:

◆ operator new()

void * FQueuedLowLevelThreadPool::operator new ( size_t size)
inline

Definition at line 382 of file QueuedThreadPoolWrapper.h.

+ Here is the call graph for this function:

◆ Pause()

void FQueuedLowLevelThreadPool::Pause ( )
inline

Queued task are not scheduled against the wrapped thread-pool until resumed

Definition at line 395 of file QueuedThreadPoolWrapper.h.

◆ Resume()

void FQueuedLowLevelThreadPool::Resume ( int32 InNumQueuedWork = -1)
inline

Resume a specified amount of queued work, or -1 to unpause.

Definition at line 403 of file QueuedThreadPoolWrapper.h.

+ Here is the call graph for this function:

◆ RetractQueuedWork()

bool FQueuedLowLevelThreadPool::RetractQueuedWork ( IQueuedWork * InQueuedWork)
inlineoverrideprivatevirtual

Attempts to retract a previously queued task.

Parameters
InQueuedWorkThe work to try to retract
Returns
true if the work was retracted
See also
AddQueuedWork

Implements FQueuedThreadPool.

Definition at line 481 of file QueuedThreadPoolWrapper.h.

+ Here is the call graph for this function:

◆ ScheduleTasks()

void FQueuedLowLevelThreadPool::ScheduleTasks ( bool & bWakeUpWorker)
inlineprivate

Definition at line 426 of file QueuedThreadPoolWrapper.h.

+ Here is the caller graph for this function:

Member Data Documentation

◆ bIsExiting

std::atomic_bool FQueuedLowLevelThreadPool::bIsExiting {false}
private

Definition at line 561 of file QueuedThreadPoolWrapper.h.

◆ bIsPaused

std::atomic_bool FQueuedLowLevelThreadPool::bIsPaused {false}
private

Definition at line 562 of file QueuedThreadPoolWrapper.h.

◆ PendingWork

FAAArrayQueue<FQueuedWorkInternalData> FQueuedLowLevelThreadPool::PendingWork[int32(EQueuedWorkPriority::Count)]
private

Definition at line 537 of file QueuedThreadPoolWrapper.h.

◆ PriorityMapper

TFunction<EQueuedWorkPriority(EQueuedWorkPriority)> FQueuedLowLevelThreadPool::PriorityMapper
private

Definition at line 558 of file QueuedThreadPoolWrapper.h.

◆ Scheduler

LowLevelTasks::FScheduler* FQueuedLowLevelThreadPool::Scheduler = nullptr
private

Definition at line 557 of file QueuedThreadPoolWrapper.h.

◆ TaskCount

std::atomic_uint FQueuedLowLevelThreadPool::TaskCount {0}
private

Definition at line 560 of file QueuedThreadPoolWrapper.h.


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