Csound API  6.18
concurrent_queue< Data > Class Template Reference

A thread-safe queue, or first-in first-out (FIFO) queue, implemented using only the standard C++11 library. More...

#include <csound_threaded.hpp>

+ Inheritance diagram for concurrent_queue< Data >:

Public Member Functions

void push (Data const &data)
 
bool empty () const
 
bool try_pop (Data &popped_value)
 
void wait_and_pop (Data &popped_value)
 

Private Attributes

std::queue< Data > queue_
 
std::mutex mutex_
 
std::condition_variable condition_variable_
 

Detailed Description

template<typename Data>
class concurrent_queue< Data >

A thread-safe queue, or first-in first-out (FIFO) queue, implemented using only the standard C++11 library.

The Data should be a simple type, such as a pointer.

Member Function Documentation

◆ empty()

template<typename Data>
bool concurrent_queue< Data >::empty ( ) const
inline

◆ push()

template<typename Data>
void concurrent_queue< Data >::push ( Data const &  data)
inline

◆ try_pop()

template<typename Data>
bool concurrent_queue< Data >::try_pop ( Data &  popped_value)
inline

◆ wait_and_pop()

template<typename Data>
void concurrent_queue< Data >::wait_and_pop ( Data &  popped_value)
inline

Field Documentation

◆ condition_variable_

template<typename Data>
std::condition_variable concurrent_queue< Data >::condition_variable_
private

◆ mutex_

template<typename Data>
std::mutex concurrent_queue< Data >::mutex_
private

◆ queue_

template<typename Data>
std::queue<Data> concurrent_queue< Data >::queue_
private