diff options
author | David Robillard <d@drobilla.net> | 2024-11-17 15:51:30 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-11-24 19:06:36 -0500 |
commit | 73e0744d9c2381038fbda7f2c53a0aabd6780b03 (patch) | |
tree | b093118645a82bc717186a97494440bdff68a688 | |
parent | a1e30029fb5254ae83a056bc192627e3dbf6c205 (diff) | |
download | jalv-73e0744d9c2381038fbda7f2c53a0aabd6780b03.tar.gz jalv-73e0744d9c2381038fbda7f2c53a0aabd6780b03.tar.bz2 jalv-73e0744d9c2381038fbda7f2c53a0aabd6780b03.zip |
Replace misleading function name and documentation
Also clean up the frees in jalv_worker_new() to be in stack order while we're
at it.
-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. |