diff options
Diffstat (limited to 'src/worker.h')
-rw-r--r-- | src/worker.h | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/worker.h b/src/worker.h index 88b011b..b95fcc2 100644 --- a/src/worker.h +++ b/src/worker.h @@ -6,10 +6,10 @@ #include "attributes.h" -#include "zix/sem.h" - #include "lv2/core/lv2.h" #include "lv2/worker/worker.h" +#include "zix/sem.h" +#include "zix/status.h" #include <stdbool.h> #include <stdint.h> @@ -37,18 +37,23 @@ JalvWorker* jalv_worker_new(ZixSem* lock, bool threaded); /** - Attach the worker to a plugin instance. - - This must be called before scheduling any work. + Free a worker allocated with jalv_worker_new(). - @param worker Worker to activate and attach to a plugin. - @param iface Worker interface from plugin. - @param handle Handle to the LV2 plugin this worker is for. + Calls jalv_worker_exit() to terminate the running thread if necessary. */ void -jalv_worker_attach(JalvWorker* worker, - const LV2_Worker_Interface* iface, - LV2_Handle handle); +jalv_worker_free(JalvWorker* worker); + +/** + Launch the worker's thread. + + For threaded workers, this launches the thread if it isn't already running. + For non-threaded workers, this does nothing. + + @return Zero on success, or a non-zero error code if launching failed. +*/ +ZixStatus +jalv_worker_launch(JalvWorker* worker); /** Terminate the worker's thread if necessary. @@ -60,12 +65,18 @@ void jalv_worker_exit(JalvWorker* worker); /** - Free a worker allocated with jalv_worker_new(). + Attach the worker to a plugin instance. - Calls jalv_worker_exit() to terminate the running thread if necessary. + This must be called before scheduling any work. + + @param worker Worker to activate and attach to a plugin. + @param iface Worker interface from plugin. + @param handle Handle to the LV2 plugin this worker is for. */ void -jalv_worker_free(JalvWorker* worker); +jalv_worker_attach(JalvWorker* worker, + const LV2_Worker_Interface* iface, + LV2_Handle handle); /** Schedule work to be performed by the worker in the audio thread. |