aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-03-02 10:24:19 +0100
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-03-02 10:24:19 +0100
commit6dec13b009e6bba83d69d177d665aacbaf6f40fd (patch)
tree4a7a0e8ce41e23d30c2cb0ee4411788bb32679d0
parent9161569bd6355dcf14e8a37fe352007e3f14942f (diff)
downloadsynthpod-6dec13b009e6bba83d69d177d665aacbaf6f40fd.tar.xz
bin: fix logic to figure out whether on dsp thread
-rw-r--r--VERSION2
-rw-r--r--bin/synthpod_alsa.c6
-rw-r--r--bin/synthpod_bin.c10
-rw-r--r--bin/synthpod_bin.h3
-rw-r--r--bin/synthpod_dummy.c6
-rw-r--r--bin/synthpod_jack.c4
6 files changed, 16 insertions, 15 deletions
diff --git a/VERSION b/VERSION
index 0bbbd16..f816ff3 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.5911
+0.1.5913
diff --git a/bin/synthpod_alsa.c b/bin/synthpod_alsa.c
index 4ac5b45..074d467 100644
--- a/bin/synthpod_alsa.c
+++ b/bin/synthpod_alsa.c
@@ -532,7 +532,7 @@ _rt_thread(void *data)
prog_t *handle = data;
bin_t *bin = &handle->bin;
- pthread_t self = pthread_self();
+ bin->dsp_thread = pthread_self();
if(handle->bin.audio_prio)
{
@@ -542,7 +542,7 @@ _rt_thread(void *data)
if(schedp.sched_priority)
{
- if(pthread_setschedparam(self, SCHED_FIFO, &schedp))
+ if(pthread_setschedparam(bin->dsp_thread, SCHED_FIFO, &schedp))
bin_log_error(bin, "%s: pthread_setschedparam failed\n", __func__);
}
}
@@ -552,7 +552,7 @@ _rt_thread(void *data)
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(0, &cpuset);
- if(pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset))
+ if(pthread_setaffinity_np(bin->dsp_thread, sizeof(cpu_set_t), &cpuset))
bin_log_error(bin, "%s: pthread_setaffinity_np failed\n", __func__);
}
diff --git a/bin/synthpod_bin.c b/bin/synthpod_bin.c
index 79b8ccb..55c5f0b 100644
--- a/bin/synthpod_bin.c
+++ b/bin/synthpod_bin.c
@@ -167,11 +167,11 @@ _atomic_unlock(atomic_flag *flag)
}
static inline bool
-_is_worker_thread(bin_t *bin)
+_is_dsp_thread(bin_t *bin)
{
const pthread_t this = pthread_self();
- return pthread_equal(this, bin->self);
+ return pthread_equal(this, bin->dsp_thread);
}
__non_realtime static int
@@ -179,7 +179,7 @@ _log_vprintf(void *data, LV2_URID type, const char *fmt, va_list args)
{
bin_t *bin = data;
- const bool is_worker_thread = _is_worker_thread(bin);
+ const bool is_worker_thread = !_is_dsp_thread(bin);
// check for trace mode AND DSP thread ID
if(!is_worker_thread)
@@ -283,7 +283,7 @@ __realtime static char *
_mapper_alloc_rt(void *data, size_t size)
{
bin_t *bin = data;
- const bool is_worker_thread = _is_worker_thread(bin);
+ const bool is_worker_thread = !_is_dsp_thread(bin);
bool more;
char *pool = lfrtm_alloc(bin->lfrtm, size, &more);
@@ -389,7 +389,7 @@ bin_init(bin_t *bin, uint32_t sample_rate)
bin->app_driver.cpu_affinity = bin->cpu_affinity;
bin->app_driver.close_request = _close_request;
- bin->self = pthread_self(); // thread ID of UI thread
+ bin->worker_thread = pthread_self(); // thread ID of UI thread
bin->first = true;
bin->sb_driver.socket_path = bin->socket_path;
diff --git a/bin/synthpod_bin.h b/bin/synthpod_bin.h
index 8b535a3..ba85c12 100644
--- a/bin/synthpod_bin.h
+++ b/bin/synthpod_bin.h
@@ -95,7 +95,8 @@ struct _bin_t {
LV2_Log_Log log;
- pthread_t self;
+ pthread_t worker_thread;
+ pthread_t dsp_thread;
atomic_flag trace_lock;
bool has_gui;
diff --git a/bin/synthpod_dummy.c b/bin/synthpod_dummy.c
index 94127b3..451df05 100644
--- a/bin/synthpod_dummy.c
+++ b/bin/synthpod_dummy.c
@@ -268,7 +268,7 @@ _rt_thread(void *data)
prog_t *handle = data;
bin_t *bin = &handle->bin;
- pthread_t self = pthread_self();
+ bin->dsp_thread = pthread_self();
if(handle->bin.audio_prio)
{
@@ -278,7 +278,7 @@ _rt_thread(void *data)
if(schedp.sched_priority)
{
- if(pthread_setschedparam(self, SCHED_FIFO, &schedp))
+ if(pthread_setschedparam(bin->dsp_thread, SCHED_FIFO, &schedp))
bin_log_error(bin, "%s: pthread_setschedparam error\n", __func__);
}
}
@@ -288,7 +288,7 @@ _rt_thread(void *data)
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(0, &cpuset);
- if(pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset))
+ if(pthread_setaffinity_np(bin->dsp_thread, sizeof(cpu_set_t), &cpuset))
bin_log_error(bin, "%s: pthread_setaffinity_np error\n", __func__);
}
diff --git a/bin/synthpod_jack.c b/bin/synthpod_jack.c
index 41f5d8b..0df0e2e 100644
--- a/bin/synthpod_jack.c
+++ b/bin/synthpod_jack.c
@@ -193,14 +193,14 @@ _process(jack_nframes_t nsamples, void *data)
if(bin->first)
{
- pthread_t self = pthread_self();
+ bin->dsp_thread = pthread_self();
if(handle->bin.cpu_affinity)
{
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(0, &cpuset);
- if(pthread_setaffinity_np(self, sizeof(cpu_set_t), &cpuset))
+ if(pthread_setaffinity_np(bin->dsp_thread, sizeof(cpu_set_t), &cpuset))
bin_log_trace(bin, "%s: pthread_setaffinity_np error\n", __func__);
}