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

#include <QueuedThreadPool.h>

+ Collaboration diagram for FThreadPoolPriorityQueue:

Public Member Functions

 FThreadPoolPriorityQueue ()
 
void Enqueue (IQueuedWork *InQueuedWork, EQueuedWorkPriority InPriority=EQueuedWorkPriority::Normal)
 
bool Retract (IQueuedWork *InQueuedWork)
 
IQueuedWorkDequeue (EQueuedWorkPriority *OutDequeuedWorkPriority=nullptr)
 
IQueuedWorkPeek (EQueuedWorkPriority *OutDequeuedWorkPriority=nullptr) const
 
void Reset ()
 
int32 Num () const
 
void Sort (EQueuedWorkPriority InPriorityBucket, TFunctionRef< bool(const IQueuedWork *A, const IQueuedWork *B)> Predicate)
 

Private Attributes

int32 FirstNonEmptyQueueIndex = 0
 
TArray< TArray< IQueuedWork * >, TInlineAllocator< static_cast< int32 >(EQueuedWorkPriority::Lowest)+1 > > PriorityQueuedWork
 
TAtomic< int32NumQueuedWork
 

Detailed Description

Priority Queue tailored for FQueuedThreadPool implementation

This class is NOT thread-safe and must be properly protected.

Definition at line 51 of file QueuedThreadPool.h.

Constructor & Destructor Documentation

◆ FThreadPoolPriorityQueue()

FThreadPoolPriorityQueue::FThreadPoolPriorityQueue ( )

Member Function Documentation

◆ Dequeue()

IQueuedWork * FThreadPoolPriorityQueue::Dequeue ( EQueuedWorkPriority * OutDequeuedWorkPriority = nullptr)

Get the next work item in priority order.

◆ Enqueue()

void FThreadPoolPriorityQueue::Enqueue ( IQueuedWork * InQueuedWork,
EQueuedWorkPriority InPriority = EQueuedWorkPriority::Normal )

Enqueue a work item at specified priority

◆ Num()

int32 FThreadPoolPriorityQueue::Num ( ) const
inline

Get the total number of queued items.

Definition at line 84 of file QueuedThreadPool.h.

◆ Peek()

IQueuedWork * FThreadPoolPriorityQueue::Peek ( EQueuedWorkPriority * OutDequeuedWorkPriority = nullptr) const

Get the next work item in priority order without actually dequeuing.

◆ Reset()

void FThreadPoolPriorityQueue::Reset ( )

Empty the queue.

◆ Retract()

bool FThreadPoolPriorityQueue::Retract ( IQueuedWork * InQueuedWork)

Search and remove a queued work item from the list

◆ Sort()

void FThreadPoolPriorityQueue::Sort ( EQueuedWorkPriority InPriorityBucket,
TFunctionRef< bool(const IQueuedWork *A, const IQueuedWork *B)> Predicate )

Sort Priority Bucket given Predicate

Member Data Documentation

◆ FirstNonEmptyQueueIndex

int32 FThreadPoolPriorityQueue::FirstNonEmptyQueueIndex = 0
private

The first queue to extract a work item from to avoid scanning all priorities when unqueuing.

Definition at line 92 of file QueuedThreadPool.h.

◆ NumQueuedWork

TAtomic<int32> FThreadPoolPriorityQueue::NumQueuedWork
private

Definition at line 94 of file QueuedThreadPool.h.

◆ PriorityQueuedWork

TArray<TArray<IQueuedWork*>, TInlineAllocator<static_cast<int32>(EQueuedWorkPriority::Lowest) + 1> > FThreadPoolPriorityQueue::PriorityQueuedWork
private

Definition at line 93 of file QueuedThreadPool.h.


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