Loading...
Searching...
No Matches
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

References mutex_, and queue_.

## push()

template<typename Data>

void concurrent_queue< Data >::push | ( | Data const & | data | ) |

inline

References condition_variable_, mutex_, and queue_.

## try_pop()

template<typename Data>

bool concurrent_queue< Data >::try_pop | ( | Data & | popped_value | ) |

inline

References mutex_, and queue_.

## wait_and_pop()

template<typename Data>

void concurrent_queue< Data >::wait_and_pop | ( | Data & | popped_value | ) |

inline

References condition_variable_, mutex_, and queue_.

## Field Documentation

## condition_variable_

template<typename Data>

std::condition_variable concurrent_queue< Data >::condition_variable_

private

Referenced by push(), and wait_and_pop().

## mutex_

template<typename Data>

std::mutex concurrent_queue< Data >::mutex_

private

Referenced by empty(), push(), try_pop(), and wait_and_pop().

## queue_

template<typename Data>

std::queue<Data> concurrent_queue< Data >::queue_

private

Referenced by empty(), push(), try_pop(), and wait_and_pop().