Thread safe priority queue.
More...
#include <safe_queue.h>
|
bool | Push (const T &e, int priority) |
| Push an element into the queue with a given priority. More...
|
|
void | Pop (T &e) |
| Pop an element from the queue with the highest priority. More...
|
|
bool | Pop (T &e, std::uint64_t timeout) |
| Pop the item with the highest priority from the queue until one element is poped or timeout. More...
|
|
bool | TryPop (T &e) |
| Try to pop an element from the queue. More...
|
|
unsigned int | Size () const |
|
template<typename T>
class PriorityQueue< T >
Thread safe priority queue.
◆ Pop() [1/2]
Pop an element from the queue with the highest priority.
It blocks until one element is poped.
◆ Pop() [2/2]
Pop the item with the highest priority from the queue until one element is poped or timeout.
- Parameters
-
[in] | timeout,return | false if no element is poped after this number of microseconds. |
◆ Push()
Push an element into the queue with a given priority.
The queue should not be a priority queue.
- Returns
- true if success; otherwise false, e.g., due to capacity constraint.
◆ Size()
- Returns
- Number of elements in the queue.
◆ TryPop()
Try to pop an element from the queue.
- Returns
- false if the queue is empty now.
The documentation for this class was generated from the following file: