TrinityCore
|
#include <LockedQueue.h>
Public Member Functions | |
LockedQueue () | |
Create a LockedQueue. More... | |
virtual | ~LockedQueue () |
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 |
Cancellation flag. More... | |
Definition at line 25 of file LockedQueue.h.
|
inline |
Create a LockedQueue.
Definition at line 39 of file LockedQueue.h.
|
inlinevirtual |
Destroy a LockedQueue.
Definition at line 45 of file LockedQueue.h.
|
inline |
Adds an item to the queue.
Definition at line 50 of file LockedQueue.h.
|
inline |
Cancels the queue.
Definition at line 111 of file LockedQueue.h.
|
inline |
Checks if the queue is cancelled.
Definition at line 119 of file LockedQueue.h.
|
inline |
! Checks if we're empty or not with locks held
Definition at line 145 of file LockedQueue.h.
|
inline |
Locks the queue for access.
Definition at line 126 of file LockedQueue.h.
|
inline |
Gets the next result in the queue, if any.
Definition at line 68 of file LockedQueue.h.
|
inline |
|
inline |
Peeks at the top of the queue. Check if the queue is empty before calling! Remember to unlock after use if autoUnlock == false.
Definition at line 98 of file LockedQueue.h.
|
inline |
! Calls pop_front of the queue
Definition at line 138 of file LockedQueue.h.
|
inline |
Adds items back to front of the queue.
Definition at line 61 of file LockedQueue.h.
|
inline |
Unlocks the queue.
Definition at line 132 of file LockedQueue.h.
|
private |
Cancellation flag.
Definition at line 34 of file LockedQueue.h.
|
private |
Lock access to the queue.
Definition at line 28 of file LockedQueue.h.
|
private |
Storage backing the queue.
Definition at line 31 of file LockedQueue.h.