AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "LockedQueue.h"
Public Member Functions | |
LockedQueue ()=default | |
Create a LockedQueue. More... | |
virtual | ~LockedQueue ()=default |
Destroy a LockedQueue. More... | |
void | add (const T &item) |
Adds an item to the queue. More... | |
template<class Iterator > | |
void | readd (Iterator begin, Iterator end) |
Adds items back to front of the queue. More... | |
bool | next (T &result) |
Gets the next result in the queue, if any. More... | |
template<class Checker > | |
bool | next (T &result, Checker &check) |
T & | peek (bool autoUnlock=false) |
Peeks at the top of the queue. Check if the queue is empty before calling! Remember to unlock after use if autoUnlock == false. More... | |
void | cancel () |
Cancels the queue. More... | |
bool | cancelled () |
Checks if the queue is cancelled. More... | |
void | lock () |
Locks the queue for access. More... | |
void | unlock () |
Unlocks the queue. More... | |
void | pop_front () |
! Calls pop_front of the queue More... | |
bool | empty () |
! Checks if we're empty or not with locks held More... | |
Private Attributes | |
std::mutex | _lock |
Lock access to the queue. More... | |
StorageType | _queue |
Storage backing the queue. More... | |
volatile bool | _canceled {false} |
Cancellation flag. More... | |
|
default |
Create a LockedQueue.
|
virtualdefault |
Destroy a LockedQueue.
|
inline |
Adds an item to the queue.
References LockedQueue< T, StorageType >::_queue, LockedQueue< T, StorageType >::lock(), and LockedQueue< T, StorageType >::unlock().
Referenced by World::AddSession(), World::QueueCliCommand(), and WorldSession::QueuePacket().
|
inline |
Cancels the queue.
References LockedQueue< T, StorageType >::_canceled, LockedQueue< T, StorageType >::_lock, and LockedQueue< T, StorageType >::lock().
|
inline |
Checks if the queue is cancelled.
References LockedQueue< T, StorageType >::_canceled, LockedQueue< T, StorageType >::_lock, and LockedQueue< T, StorageType >::lock().
|
inline |
! Checks if we're empty or not with locks held
References LockedQueue< T, StorageType >::_lock, LockedQueue< T, StorageType >::_queue, and LockedQueue< T, StorageType >::lock().
|
inline |
Locks the queue for access.
Referenced by LockedQueue< T, StorageType >::add(), LockedQueue< T, StorageType >::cancel(), LockedQueue< T, StorageType >::cancelled(), LockedQueue< T, StorageType >::empty(), LockedQueue< T, StorageType >::next(), LockedQueue< T, StorageType >::peek(), LockedQueue< T, StorageType >::pop_front(), and LockedQueue< T, StorageType >::readd().
|
inline |
Gets the next result in the queue, if any.
References LockedQueue< T, StorageType >::_lock, LockedQueue< T, StorageType >::_queue, and LockedQueue< T, StorageType >::lock().
Referenced by World::ProcessCliCommands(), WorldSession::Update(), World::UpdateSessions(), World::~World(), and WorldSession::~WorldSession().
|
inline |
References LockedQueue< T, StorageType >::_lock, LockedQueue< T, StorageType >::_queue, and LockedQueue< T, StorageType >::lock().
|
inline |
Peeks at the top of the queue. Check if the queue is empty before calling! Remember to unlock after use if autoUnlock == false.
References LockedQueue< T, StorageType >::_queue, LockedQueue< T, StorageType >::lock(), and LockedQueue< T, StorageType >::unlock().
|
inline |
! Calls pop_front of the queue
References LockedQueue< T, StorageType >::_lock, LockedQueue< T, StorageType >::_queue, and LockedQueue< T, StorageType >::lock().
|
inline |
Adds items back to front of the queue.
References LockedQueue< T, StorageType >::_lock, LockedQueue< T, StorageType >::_queue, and LockedQueue< T, StorageType >::lock().
Referenced by WorldSession::Update().
|
inline |
Unlocks the queue.
Referenced by LockedQueue< T, StorageType >::add(), and LockedQueue< T, StorageType >::peek().
|
private |
Cancellation flag.
Referenced by LockedQueue< T, StorageType >::cancel(), and LockedQueue< T, StorageType >::cancelled().
|
private |
|
private |