KiCad PCB EDA Suite
|
Synchronized, locking queue. More...
#include <sync_queue.h>
Public Member Functions | |
SYNC_QUEUE () | |
void | push (T const &aValue) |
Push a value onto the queue. | |
void | move_push (T &&aValue) |
Move a value onto the queue. | |
bool | pop (T &aReceiver) |
Pop a value if the queue into the provided variable. | |
bool | empty () const |
Return true if the queue is empty. | |
size_t | size () const |
Return the size of the queue. | |
void | clear () |
Clear the queue. | |
Private Types | |
typedef std::lock_guard< std::mutex > | GUARD |
Private Attributes | |
std::queue< T > | m_queue |
std::mutex | m_mutex |
Synchronized, locking queue.
Safe for multiple producer/multiple consumer environments with nontrivial data (though bear in mind data needs to be copied in and out).
Definition at line 31 of file sync_queue.h.
|
private |
Definition at line 111 of file sync_queue.h.
|
inline |
Definition at line 34 of file sync_queue.h.
|
inline |
Clear the queue.
Definition at line 100 of file sync_queue.h.
References SYNC_QUEUE< T >::m_mutex, and SYNC_QUEUE< T >::m_queue.
Referenced by DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles(), and FOOTPRINT_LIST_IMPL::ReadFootprintFiles().
|
inline |
Return true if the queue is empty.
Definition at line 82 of file sync_queue.h.
References SYNC_QUEUE< T >::m_mutex, and SYNC_QUEUE< T >::m_queue.
Referenced by DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles(), FOOTPRINT_LIST_IMPL::ReadFootprintFiles(), and PCM_TASK_MANAGER::RunQueue().
|
inline |
Move a value onto the queue.
Useful for e.g. unique_ptr.
Definition at line 50 of file sync_queue.h.
References SYNC_QUEUE< T >::m_mutex, and SYNC_QUEUE< T >::m_queue.
Referenced by DESIGN_BLOCK_LIST_IMPL::CatchErrors(), FOOTPRINT_LIST_IMPL::CatchErrors(), DESIGN_BLOCK_LIST_IMPL::loadDesignBlocks(), and FOOTPRINT_LIST_IMPL::loadFootprints().
|
inline |
Pop a value if the queue into the provided variable.
If the queue is empty, the variable is not touched.
Definition at line 63 of file sync_queue.h.
References SYNC_QUEUE< T >::m_mutex, and SYNC_QUEUE< T >::m_queue.
Referenced by DESIGN_BLOCK_LIST_IMPL::loadDesignBlocks(), FOOTPRINT_LIST_IMPL::loadFootprints(), DESIGN_BLOCK_LIST_IMPL::loadLibs(), FOOTPRINT_LIST_IMPL::loadLibs(), and PCM_TASK_MANAGER::RunQueue().
|
inline |
Push a value onto the queue.
Definition at line 41 of file sync_queue.h.
References SYNC_QUEUE< T >::m_mutex, and SYNC_QUEUE< T >::m_queue.
Referenced by PCM_TASK_MANAGER::DownloadAndInstall(), DESIGN_BLOCK_LIST_IMPL::loadLibs(), FOOTPRINT_LIST_IMPL::loadLibs(), DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles(), FOOTPRINT_LIST_IMPL::ReadFootprintFiles(), and PCM_TASK_MANAGER::Uninstall().
|
inline |
Return the size of the queue.
Definition at line 91 of file sync_queue.h.
References SYNC_QUEUE< T >::m_mutex, and SYNC_QUEUE< T >::m_queue.
Referenced by DESIGN_BLOCK_LIST_IMPL::loadDesignBlocks(), FOOTPRINT_LIST_IMPL::loadFootprints(), DESIGN_BLOCK_LIST_IMPL::loadLibs(), FOOTPRINT_LIST_IMPL::loadLibs(), DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles(), FOOTPRINT_LIST_IMPL::ReadFootprintFiles(), and PCM_TASK_MANAGER::RunQueue().
|
mutableprivate |
Definition at line 114 of file sync_queue.h.
Referenced by SYNC_QUEUE< T >::clear(), SYNC_QUEUE< T >::empty(), SYNC_QUEUE< T >::move_push(), SYNC_QUEUE< T >::pop(), SYNC_QUEUE< T >::push(), and SYNC_QUEUE< T >::size().
|
private |
Definition at line 113 of file sync_queue.h.
Referenced by SYNC_QUEUE< T >::clear(), SYNC_QUEUE< T >::empty(), SYNC_QUEUE< T >::move_push(), SYNC_QUEUE< T >::pop(), SYNC_QUEUE< T >::push(), and SYNC_QUEUE< T >::size().