diff options
-rw-r--r-- | src/jalv.c | 4 | ||||
-rw-r--r-- | src/worker.c | 10 | ||||
-rw-r--r-- | src/worker.h | 9 |
3 files changed, 12 insertions, 11 deletions
@@ -1082,8 +1082,8 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv) (const LV2_Worker_Interface*)lilv_instance_get_extension_data( jalv->instance, LV2_WORKER__interface); - jalv_worker_start(jalv->worker, worker_iface, jalv->instance->lv2_handle); - jalv_worker_start( + jalv_worker_attach(jalv->worker, worker_iface, jalv->instance->lv2_handle); + jalv_worker_attach( jalv->state_worker, worker_iface, jalv->instance->lv2_handle); jalv_log(JALV_LOG_INFO, "\n"); diff --git a/src/worker.c b/src/worker.c index 0dca657..d34fedb 100644 --- a/src/worker.c +++ b/src/worker.c @@ -133,16 +133,16 @@ jalv_worker_new(ZixSem* const lock, const bool threaded) } } - free(worker); - zix_ring_free(responses); free(response); + zix_ring_free(responses); + free(worker); return NULL; } void -jalv_worker_start(JalvWorker* const worker, - const LV2_Worker_Interface* const iface, - LV2_Handle handle) +jalv_worker_attach(JalvWorker* const worker, + const LV2_Worker_Interface* const iface, + LV2_Handle handle) { if (worker) { worker->iface = iface; diff --git a/src/worker.h b/src/worker.h index a98bfc6..88b011b 100644 --- a/src/worker.h +++ b/src/worker.h @@ -37,17 +37,18 @@ JalvWorker* jalv_worker_new(ZixSem* lock, bool threaded); /** - Start performing work for a plugin, launching the thread if necessary. + Attach the worker to a plugin instance. 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_start(JalvWorker* worker, - const LV2_Worker_Interface* iface, - LV2_Handle handle); +jalv_worker_attach(JalvWorker* worker, + const LV2_Worker_Interface* iface, + LV2_Handle handle); /** Terminate the worker's thread if necessary. |