#include <genesis/utils/threading/threadsafe_queue.hpp>
Thread-safe queue.
This implementation is from the excellent "C++ Concurrency in Action" book by Anthony Williams, second edition, chapter 4, listing 4.5. The code is published at https://github.com/anthonywilliams/ccia_code_samples under the Boost Software License.
We simply added the Rule of Five implementations here, and renamed variables to fit with our coding standards. The rest is kept as-is.
Definition at line 89 of file threadsafe_queue.hpp.
Public Member Functions | |
ThreadsafeQueue ()=default | |
ThreadsafeQueue (ThreadsafeQueue &&other) noexcept | |
ThreadsafeQueue (ThreadsafeQueue const &other) | |
~ThreadsafeQueue ()=default | |
bool | empty () const |
ThreadsafeQueue & | operator= (ThreadsafeQueue &&other) noexcept |
ThreadsafeQueue & | operator= (ThreadsafeQueue const &other) |
void | push (T new_value) |
std::shared_ptr< T > | try_pop () |
bool | try_pop (T &value) |
std::shared_ptr< T > | wait_and_pop () |
void | wait_and_pop (T &value) |
|
default |
|
default |
|
inline |
Definition at line 100 of file threadsafe_queue.hpp.
|
inlinenoexcept |
Definition at line 106 of file threadsafe_queue.hpp.
|
inline |
Definition at line 193 of file threadsafe_queue.hpp.
|
inlinenoexcept |
Definition at line 129 of file threadsafe_queue.hpp.
|
inline |
Definition at line 112 of file threadsafe_queue.hpp.
|
inline |
Definition at line 147 of file threadsafe_queue.hpp.
|
inline |
Definition at line 182 of file threadsafe_queue.hpp.
|
inline |
Definition at line 171 of file threadsafe_queue.hpp.
|
inline |
Definition at line 162 of file threadsafe_queue.hpp.
|
inline |
Definition at line 154 of file threadsafe_queue.hpp.