KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SYNC_QUEUE< T > Class Template Reference

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
 

Detailed Description

template<typename T>
class SYNC_QUEUE< T >

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.

Member Typedef Documentation

◆ GUARD

template<typename T >
typedef std::lock_guard<std::mutex> SYNC_QUEUE< T >::GUARD
private

Definition at line 111 of file sync_queue.h.

Constructor & Destructor Documentation

◆ SYNC_QUEUE()

template<typename T >
SYNC_QUEUE< T >::SYNC_QUEUE ( )
inline

Definition at line 34 of file sync_queue.h.

Member Function Documentation

◆ clear()

template<typename T >
void SYNC_QUEUE< T >::clear ( )
inline

◆ empty()

template<typename T >
bool SYNC_QUEUE< T >::empty ( ) const
inline

◆ move_push()

template<typename T >
void SYNC_QUEUE< T >::move_push ( T &&  aValue)
inline

◆ pop()

template<typename T >
bool SYNC_QUEUE< T >::pop ( T &  aReceiver)
inline

Pop a value if the queue into the provided variable.

If the queue is empty, the variable is not touched.

Returns
true if a value was popped.

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().

◆ push()

◆ size()

Member Data Documentation

◆ m_mutex

template<typename T >
std::mutex SYNC_QUEUE< T >::m_mutex
mutableprivate

◆ m_queue

template<typename T >
std::queue<T> SYNC_QUEUE< T >::m_queue
private

The documentation for this class was generated from the following file: