mpsc_queue producer worker class.
More...
#include <libpmemobj++/experimental/mpsc_queue.hpp>
mpsc_queue producer worker class.
To write data concurrently into the mpsc_queue in the multi-threaded application, each producer thread have to use its own worker object. Workers might be added concurrently to the mpsc_queue.
- Note
- All workers have to be destroyed before destruction of the mpsc_queue
- See also
- mpsc_queue:try_produce_batch()
◆ worker() [1/2]
pmem::obj::experimental::mpsc_queue::worker::worker |
( |
mpsc_queue * |
q | ) |
|
|
inline |
Default constructor of worker object.
It's registered as a worker for passed mpsc_queue
- Parameters
-
◆ ~worker()
pmem::obj::experimental::mpsc_queue::worker::~worker |
( |
| ) |
|
|
inline |
Default destructor of worker object.
It unregisters the worker (in ringbuf and in queue's manager).
◆ worker() [2/2]
Move constructor, from.
- Parameters
-
◆ operator=()
Move assignment operator, from.
- Parameters
-
◆ try_produce()
template<typename Function = void (*)(pmem::obj::string_view)>
Copies data from pmem::obj::string_view into the mpsc_queue.
- Parameters
-
[in] | data | Data to be copied into mpsc_queue |
[in] | on_produce | Function evaluated on the data in queue, before the data is visible for the consumer. By default do nothing. |
- Returns
- true if f were evaluated, all data copied by it saved in the mpsc_queue, and are visible for the consumer.
worker.try_produce(
"Left for next run");
worker(mpsc_queue *q)
Default constructor of worker object.
Definition: mpsc_queue.hpp:474
The documentation for this class was generated from the following file: