aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-05-30 19:47:52 -0400
committerDavid Robillard <d@drobilla.net>2022-08-17 13:50:29 -0400
commit2920fd5f170179e4e1a880856068d3d8b5f0f420 (patch)
treee5c10ef1746b7893028244e25d045083ee4cf1e4
parent218589a6dad6decf6f5998068ff723b69854db0a (diff)
downloadjalv-2920fd5f170179e4e1a880856068d3d8b5f0f420.tar.gz
jalv-2920fd5f170179e4e1a880856068d3d8b5f0f420.tar.bz2
jalv-2920fd5f170179e4e1a880856068d3d8b5f0f420.zip
Move JalvWorker definition to worker.h
-rw-r--r--src/jalv_internal.h15
-rw-r--r--src/worker.h35
2 files changed, 34 insertions, 16 deletions
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 11bf05e..f07241b 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -10,10 +10,10 @@
#include "options.h"
#include "symap.h"
#include "urids.h"
+#include "worker.h"
#include "zix/ring.h"
#include "zix/sem.h"
-#include "zix/thread.h"
#include "lilv/lilv.h"
#include "serd/serd.h"
@@ -55,19 +55,6 @@ typedef struct Jalv Jalv;
typedef enum { JALV_RUNNING, JALV_PAUSE_REQUESTED, JALV_PAUSED } JalvPlayState;
typedef struct {
- ZixRing* requests; ///< Requests to the worker
- ZixRing* responses; ///< Responses from the worker
- void* response; ///< Worker response buffer
- ZixSem* lock; ///< Lock for plugin work() method
- bool* exit; ///< Pointer to exit flag
- ZixSem sem; ///< Worker semaphore
- ZixThread thread; ///< Worker thread
- LV2_Handle handle; ///< Plugin handle
- const LV2_Worker_Interface* iface; ///< Plugin worker interface
- bool threaded; ///< Run work in another thread
-} JalvWorker;
-
-typedef struct {
LV2_Feature map_feature;
LV2_Feature unmap_feature;
LV2_State_Make_Path make_path;
diff --git a/src/worker.h b/src/worker.h
index e3adeec..606278f 100644
--- a/src/worker.h
+++ b/src/worker.h
@@ -1,14 +1,39 @@
-// Copyright 2007-2016 David Robillard <d@drobilla.net>
+// Copyright 2007-2022 David Robillard <d@drobilla.net>
// SPDX-License-Identifier: ISC
-#include "jalv_internal.h"
+#ifndef JALV_WORKER_H
+#define JALV_WORKER_H
+
+#include "zix/ring.h"
+#include "zix/sem.h"
+#include "zix/thread.h"
#include "lilv/lilv.h"
+#include "lv2/core/lv2.h"
#include "lv2/worker/worker.h"
#include <stdbool.h>
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Worker for running non-realtime tasks for plugins
+
+typedef struct {
+ ZixRing* requests; ///< Requests to the worker
+ ZixRing* responses; ///< Responses from the worker
+ void* response; ///< Worker response buffer
+ ZixSem* lock; ///< Lock for plugin work() method
+ bool* exit; ///< Pointer to exit flag
+ ZixSem sem; ///< Worker semaphore
+ ZixThread thread; ///< Worker thread
+ LV2_Handle handle; ///< Plugin handle
+ const LV2_Worker_Interface* iface; ///< Plugin worker interface
+ bool threaded; ///< Run work in another thread
+} JalvWorker;
+
void
jalv_worker_init(JalvWorker* worker,
const LV2_Worker_Interface* iface,
@@ -27,3 +52,9 @@ jalv_worker_schedule(LV2_Worker_Schedule_Handle handle,
void
jalv_worker_emit_responses(JalvWorker* worker, LilvInstance* instance);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // JALV_WORKER_H