From aae34b2e7faead258e99e42bd199b329475eb17c Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Mon, 16 Jan 2023 11:55:59 +0000 Subject: playlist: enable queue send Apparently queue_send() silently falls back to queue_post() if sending isn't enabled. Doesn't seem like a good idea, as post and send are definitely *not* interchangeable! The playlist code relies on queue_send()'s blocking behavior to prevent the dircache thread from using potentially stale pointers. Change-Id: Ibf4b0def3bf9c96cb2fe80cd75043b7ce1dcf250 --- apps/playlist.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'apps/playlist.c') diff --git a/apps/playlist.c b/apps/playlist.c index 481524b9d4..4c21ea41f6 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -176,6 +176,7 @@ static struct playlist_info current_playlist; static bool dc_has_dirty_pointers = false; static struct event_queue playlist_queue SHAREDBSS_ATTR; +static struct queue_sender_list playlist_queue_sender_list SHAREDBSS_ATTR; static long playlist_stack[(DEFAULT_STACK_SIZE + 0x800)/sizeof(long)]; static const char dc_thread_playlist_name[] = "playlist cachectrl"; @@ -2086,11 +2087,14 @@ void playlist_init(void) playlist->max_playlist_size * sizeof(*playlist->dcfrefs), &ops); playlist->dcfrefs = core_get_data(handle); dc_copy_filerefs(playlist->dcfrefs, NULL, playlist->max_playlist_size); - create_thread(dc_thread_playlist, playlist_stack, sizeof(playlist_stack), - 0, dc_thread_playlist_name IF_PRIO(, PRIORITY_BACKGROUND) - IF_COP(, CPU)); + unsigned int playlist_thread_id = + create_thread(dc_thread_playlist, playlist_stack, sizeof(playlist_stack), + 0, dc_thread_playlist_name IF_PRIO(, PRIORITY_BACKGROUND) + IF_COP(, CPU)); queue_init(&playlist_queue, true); + queue_enable_queue_send(&playlist_queue, + &playlist_queue_sender_list, playlist_thread_id); #endif /* HAVE_DIRCACHE */ } -- cgit v1.2.3