![]() |
Knight's Tour Generator
Tourneys and the Fast Generation and Obfuscation of Closed Knight's Tours
|
Thread safe queue. More...
#include <ThreadSafeQueue.h>
Public Member Functions | |
void | push (const data &element) |
Insert at tail. More... | |
bool | pop (data &element) |
Delete from head and return. More... | |
size_t | size () |
Get queue size. More... | |
Private Attributes | |
std::queue< data > | m_stdQueue |
Queue contents. | |
std::mutex | m_mutex |
Mutex for thread safety. | |
A safe queue data structure for inter-thread communication. A mutex is used to prevent multiple threads attempting to enqueue or dequeue at the same time.
Definition at line 37 of file ThreadSafeQueue.h.
bool CThreadSafeQueue< data >::pop | ( | data & | element | ) |
Delete and return the element at the head of the queue.
element | [out] The element at the head of the queue. |
Definition at line 42 of file ThreadSafeQueue.cpp.
void CThreadSafeQueue< data >::push | ( | const data & | element | ) |
Insert an element at the end of the queue.
element | An element. |
Definition at line 32 of file ThreadSafeQueue.cpp.
size_t CThreadSafeQueue< data >::size | ( | ) |
Get the number of things in the queue.
Definition at line 59 of file ThreadSafeQueue.cpp.