aboutsummaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorJP Cimalando <jpcima@users.noreply.github.com>2018-09-17 17:09:23 +0200
committerDavid Robillard <d@drobilla.net>2018-09-18 13:51:53 +0200
commit40af4ccdb06443a9a72efa380924684ce87ec0c5 (patch)
treeaee7359877b87c36f740a2b96187123dd201423f /src/worker.c
parent2f32eb51077b707239d5e686eabe1419dca7adad (diff)
downloadjalv-40af4ccdb06443a9a72efa380924684ce87ec0c5.tar.gz
jalv-40af4ccdb06443a9a72efa380924684ce87ec0c5.tar.bz2
jalv-40af4ccdb06443a9a72efa380924684ce87ec0c5.zip
Fix a potential crash when closed with worker
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/worker.c b/src/worker.c
index 6f94997..8354ad6 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -81,10 +81,17 @@ jalv_worker_init(Jalv* jalv,
void
jalv_worker_finish(JalvWorker* worker)
{
+ if (worker->threaded) {
+ zix_sem_post(&worker->sem);
+ zix_thread_join(worker->thread, NULL);
+ }
+}
+
+void
+jalv_worker_destroy(JalvWorker* worker)
+{
if (worker->requests) {
if (worker->threaded) {
- zix_sem_post(&worker->sem);
- zix_thread_join(worker->thread, NULL);
zix_ring_free(worker->requests);
}
zix_ring_free(worker->responses);