Clearmatics Libff
0.1
C++ library for Finite Fields and Elliptic Curves
|
#include <concurrent_fifo.hpp>
Public Member Functions | |
concurrent_fifo_spsc ()=delete | |
concurrent_fifo_spsc (const concurrent_fifo_spsc &)=delete | |
concurrent_fifo_spsc & | operator= (const concurrent_fifo_spsc &)=delete |
concurrent_fifo_spsc (size_t capacity) | |
~concurrent_fifo_spsc () | |
size_t | capacity () const |
T * | try_enqueue_begin () |
T * | enqueue_begin_wait () |
void | enqueue_end () |
const T * | try_dequeue_begin () |
const T * | dequeue_begin_wait () |
void | dequeue_end () |
Protected Attributes | |
const size_t | _capacity |
T *const | _buffer |
size_t | _producer_next_idx |
std::atomic< size_t > | _producer_num_produced |
size_t | _consumer_next_idx |
std::atomic< size_t > | _consumer_num_consumed |
Simple lock-less single-producer, single-consumer fifo buffer. Exposes the raw read/write location directly, in way that the producer can know if the destination memory is available BEFORE he begins data production. In particular, if T = void *, say, the producer can recycle the buffer pointed to by the void * once try_enqueue_begin() succeeds.
Definition at line 23 of file concurrent_fifo.hpp.
|
delete |
|
delete |
libff::concurrent_fifo_spsc< T >::concurrent_fifo_spsc | ( | size_t | capacity | ) |
libff::concurrent_fifo_spsc< T >::~concurrent_fifo_spsc | ( | ) |
size_t libff::concurrent_fifo_spsc< T >::capacity | ( | ) | const |
const T* libff::concurrent_fifo_spsc< T >::dequeue_begin_wait | ( | ) |
Call try_dequeue_begin() until it succeeds. The caller should be sure that a producer will produce an element.
void libff::concurrent_fifo_spsc< T >::dequeue_end | ( | ) |
T* libff::concurrent_fifo_spsc< T >::enqueue_begin_wait | ( | ) |
Call try_enqueue_begin() until it succeeds. The caller should be sure that a consumer is active, to avoid the fifo being permanently blocked.
void libff::concurrent_fifo_spsc< T >::enqueue_end | ( | ) |
|
delete |
const T* libff::concurrent_fifo_spsc< T >::try_dequeue_begin | ( | ) |
Consumer must call this until it succeeds (returns a non-null pointer), and then read data from the returned address, before calling dequeue_end().
T* libff::concurrent_fifo_spsc< T >::try_enqueue_begin | ( | ) |
Producer must call this until it succeeds (returns a non-null pointer), and then write values at the returned address before calling enqueue_end().
|
protected |
Definition at line 60 of file concurrent_fifo.hpp.
|
protected |
Definition at line 58 of file concurrent_fifo.hpp.
|
protected |
Definition at line 65 of file concurrent_fifo.hpp.
|
protected |
Definition at line 66 of file concurrent_fifo.hpp.
|
protected |
Definition at line 62 of file concurrent_fifo.hpp.
|
protected |
Definition at line 63 of file concurrent_fifo.hpp.