![]() |
AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "LockedQueue.h"
Public Member Functions | |
| LockedQueue ()=default | |
| Default constructor to create an empty LockedQueue. | |
| virtual | ~LockedQueue ()=default |
| Destructor for LockedQueue. | |
| void | add (const T &item) |
| Adds an item to the back of the queue. | |
| template<class Iterator > | |
| void | readd (Iterator begin, Iterator end) |
| Adds a range of items to the front of the queue. | |
| bool | next (T &result) |
| Gets the next item in the queue and removes it. | |
| template<class Checker > | |
| bool | next (T &result, Checker &check) |
| Retrieves the next item from the queue if it satisfies the provided checker. | |
| T & | peek () |
| Peeks at the top of the queue without removing it. | |
| void | cancel () |
| Cancels the queue, preventing further processing of items. | |
| bool | cancelled () const |
| Checks if the queue has been canceled. | |
| bool | empty () const |
| Checks if the queue is empty. | |
| void | pop_front () |
| Removes the item at the front of the queue. | |
Private Attributes | |
| std::mutex | _lock |
| Mutex to protect access to the queue. | |
| std::atomic< bool > | _canceled {false} |
| Flag indicating if the queue is canceled. | |
| StorageType | _queue |
| Storage container for the queue. | |
|
default |
Default constructor to create an empty LockedQueue.
|
virtualdefault |
Destructor for LockedQueue.
|
inline |
Adds an item to the back of the queue.
| item | The item to be added to the queue. |
References LockedQueue< T, StorageType >::_lock, and LockedQueue< T, StorageType >::_queue.
Referenced by AuctionHouseWorkerThread::AddAuctionSearchUpdateToQueue(), WorldSessionMgr::AddSession(), World::QueueCliCommand(), and WorldSession::QueuePacket().
|
inline |
Cancels the queue, preventing further processing of items.
References LockedQueue< T, StorageType >::_canceled.
|
inline |
Checks if the queue has been canceled.
References LockedQueue< T, StorageType >::_canceled.
|
inline |
Checks if the queue is empty.
References LockedQueue< T, StorageType >::_lock, and LockedQueue< T, StorageType >::_queue.
|
inline |
Gets the next item in the queue and removes it.
| result | The variable where the next item will be stored. |
References LockedQueue< T, StorageType >::_lock, and LockedQueue< T, StorageType >::_queue.
Referenced by World::ProcessCliCommands(), AuctionHouseWorkerThread::ProcessSearchUpdates(), WorldSession::Update(), WorldSessionMgr::UpdateSessions(), World::~World(), and WorldSession::~WorldSession().
|
inline |
Retrieves the next item from the queue if it satisfies the provided checker.
| result | The variable where the next item will be stored. |
| check | A checker object that will be used to validate the item. |
References LockedQueue< T, StorageType >::_lock, and LockedQueue< T, StorageType >::_queue.
|
inline |
Peeks at the top of the queue without removing it.
References LockedQueue< T, StorageType >::_lock, and LockedQueue< T, StorageType >::_queue.
|
inline |
Removes the item at the front of the queue.
References LockedQueue< T, StorageType >::_lock, and LockedQueue< T, StorageType >::_queue.
|
inline |
Adds a range of items to the front of the queue.
| begin | Iterator pointing to the beginning of the range of items to be added. |
| end | Iterator pointing to the end of the range of items to be added. |
References LockedQueue< T, StorageType >::_lock, and LockedQueue< T, StorageType >::_queue.
Referenced by WorldSession::Update().
|
private |
Flag indicating if the queue is canceled.
Referenced by LockedQueue< T, StorageType >::cancel(), and LockedQueue< T, StorageType >::cancelled().
|
mutableprivate |
Mutex to protect access to the queue.
Referenced by LockedQueue< T, StorageType >::add(), LockedQueue< T, StorageType >::empty(), LockedQueue< T, StorageType >::next(), LockedQueue< T, StorageType >::next(), LockedQueue< T, StorageType >::peek(), LockedQueue< T, StorageType >::pop_front(), and LockedQueue< T, StorageType >::readd().
|
private |
Storage container for the queue.
Referenced by LockedQueue< T, StorageType >::add(), LockedQueue< T, StorageType >::empty(), LockedQueue< T, StorageType >::next(), LockedQueue< T, StorageType >::next(), LockedQueue< T, StorageType >::peek(), LockedQueue< T, StorageType >::pop_front(), and LockedQueue< T, StorageType >::readd().