#include <uhd/transport/bounded_buffer.hpp>
Public Member Functions | |
bounded_buffer (size_t capacity) | |
UHD_INLINE bool | push_with_haste (const elem_type &elem) |
UHD_INLINE bool | push_with_pop_on_full (const elem_type &elem) |
UHD_INLINE void | push_with_wait (const elem_type &elem) |
UHD_INLINE bool | push_with_timed_wait (const elem_type &elem, double timeout) |
UHD_INLINE bool | pop_with_haste (elem_type &elem) |
UHD_INLINE void | pop_with_wait (elem_type &elem) |
UHD_INLINE bool | pop_with_timed_wait (elem_type &elem, double timeout) |
Implement a templated bounded buffer: Used for passing elements between threads in a producer-consumer model. The bounded buffer implemented waits and timed waits with condition variables. The pop operation blocks on the bounded_buffer to become non empty. The push operation blocks on the bounded_buffer to become non full.
|
inline |
Create a new bounded buffer object.
capacity | the bounded_buffer capacity |
|
inline |
Pop an element from the bounded buffer immediately. The element will not be popped when the buffer is empty.
elem | the element reference pop to |
|
inline |
Pop an element from the bounded_buffer. Wait until the bounded_buffer becomes non-empty or timeout.
elem | the element reference pop to |
timeout | the timeout in seconds |
|
inline |
Pop an element from the bounded_buffer. Wait until the bounded_buffer becomes non-empty.
elem | the element reference pop to |
|
inline |
Push a new element into the bounded buffer immediately. The element will not be pushed when the buffer is full.
elem | the element reference pop to |
|
inline |
Push a new element into the bounded buffer. If the buffer is full prior to the push, make room by popping the oldest element.
elem | the new element to push |
|
inline |
Push a new element into the bounded_buffer. Wait until the bounded_buffer becomes non-full or timeout.
elem | the new element to push |
timeout | the timeout in seconds |
|
inline |
Push a new element into the bounded_buffer. Wait until the bounded_buffer becomes non-full.
elem | the new element to push |