diff options
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/local_compat.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/server/local_compat.c b/src/server/local_compat.c index 9870ce5..39698c5 100644 --- a/src/server/local_compat.c +++ b/src/server/local_compat.c @@ -4,7 +4,9 @@ #include "../cache/handlers/http.h" #endif #include "../cache/handlers/file.h" +#ifdef LIANA_HAVE_CDIO #include "../cache/handlers/cdio.h" +#endif #include "local_compat.h" #include "common.h" @@ -84,14 +86,15 @@ static void worker_signal_callback(void *userdata) static aki_thread_result AKI_THREADCALL queue_thread(void *userdata) { struct camu_local_compat *compat = (struct camu_local_compat *)userdata; + aki_thread_setcanceltype(AKI_THREAD_CANCEL_ASYNCHRONOUS); #ifdef CAMU_HAVE_PORTAL bool have_python = false; #endif u32 count; while (aki_packet_cache_wait(&compat->queue, &count)) { struct aki_packet *packet = aki_packet_cache_pop(&compat->queue); + aki_packet_cache_unlock(&compat->queue); if (!packet) { - aki_packet_cache_unlock(&compat->queue); break; } str local; @@ -99,6 +102,7 @@ static aki_thread_result AKI_THREADCALL queue_thread(void *userdata) struct cch_entry *entry = NULL; struct camu_post *post = NULL; if (al_str_cmp(&local, al_str_c("cdda://"), 0, 7) == 0) { +#ifdef LIANA_HAVE_CDIO entry = cch_handler_cdio_create(); struct cch_chapter *chapter = &al_array_at(entry->chapters, 0); if (local.len > 7) { @@ -109,6 +113,7 @@ static aki_thread_result AKI_THREADCALL queue_thread(void *userdata) } entry->chapter = chapter; entry->handler->maybe_spawn_worker(entry->handler, chapter->start); +#endif } else { #ifdef CAMU_HAVE_PORTAL #ifndef AKIYO_HAS_CURL @@ -141,7 +146,6 @@ static aki_thread_result AKI_THREADCALL queue_thread(void *userdata) #endif #endif } - aki_packet_cache_unlock(&compat->queue); if (entry) { struct camu_server_resource *resource = al_alloc_object(struct camu_server_resource); al_str_clone(&resource->unique_id, &local); @@ -203,7 +207,9 @@ void camu_local_compat_send(struct camu_local_compat *compat, struct aki_packet void camu_local_compat_stop(struct camu_local_compat *compat) { aki_packet_cache_disable(&compat->queue); + aki_thread_cancel(&compat->thread); aki_thread_join(&compat->thread); + aki_signal_stop(&compat->worker_signal); aki_signal_stop(&compat->result_signal); camu_queue_free(compat->results); struct aki_packet *packet; |