Ardour
9.0-pre0-582-g084a23a80d
|
#include <worker.h>
Public Member Functions | |
Worker (Workee *workee, uint32_t ring_size, bool threaded=true) | |
~Worker () | |
bool | schedule (uint32_t size, const void *data) |
bool | respond (uint32_t size, const void *data) |
void | emit_responses () |
void | set_synchronous (bool synchronous) |
Private Member Functions | |
void | run () |
bool | verify_message_completeness (PBD::RingBuffer< uint8_t > *rb) |
Private Attributes | |
Workee * | _workee |
PBD::RingBuffer< uint8_t > * | _requests |
PBD::RingBuffer< uint8_t > * | _responses |
uint8_t * | _response |
PBD::Semaphore | _sem |
PBD::Thread * | _thread |
bool | _exit |
bool | _synchronous |
A worker for non-realtime tasks scheduled from another thread.
A worker may be a separate thread that runs to execute scheduled work asynchronously, or unthreaded, in which case work is executed immediately upon scheduling by the calling thread.
ARDOUR::Worker::Worker | ( | Workee * | workee, |
uint32_t | ring_size, | ||
bool | threaded = true |
||
) |
ARDOUR::Worker::~Worker | ( | ) |
void ARDOUR::Worker::emit_responses | ( | ) |
Emit any pending responses (audio thread).
bool ARDOUR::Worker::respond | ( | uint32_t | size, |
const void * | data | ||
) |
Respond from work (worker thread).
|
private |
bool ARDOUR::Worker::schedule | ( | uint32_t | size, |
const void * | data | ||
) |
Schedule work (audio thread).
|
inline |
Enable or disable synchronous execution.
If enabled, all work is performed immediately in schedule() regardless of whether or not the worker is threaded. This is used for exporting, where we want to temporarily execute all work synchronously but the worker is typically used threaded for live rolling.
|
private |
Peek in RB, get size and check if a block of 'size' is available.
Handle the unlikely edge-case, if we're called in between the responder writing 'size' and 'data'.
rb | the ringbuffer to check |
|
private |
|
private |
|
private |
|
private |