diff options
author | JP Cimalando <jpcima@users.noreply.github.com> | 2018-09-17 17:09:23 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-09-18 13:51:53 +0200 |
commit | 40af4ccdb06443a9a72efa380924684ce87ec0c5 (patch) | |
tree | aee7359877b87c36f740a2b96187123dd201423f /src/worker.c | |
parent | 2f32eb51077b707239d5e686eabe1419dca7adad (diff) | |
download | jalv-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.c | 11 |
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); |