diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2023-01-16 11:55:59 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2023-01-16 16:57:23 +0000 |
commit | aae34b2e7faead258e99e42bd199b329475eb17c (patch) | |
tree | 0ba966ec79961a94d9f373aec2d5b55d663daf6d | |
parent | a9b93bb4cd431c097223253ced6e39b0a3d87a28 (diff) | |
download | rockbox-aae34b2e7f.tar.gz rockbox-aae34b2e7f.zip |
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
-rw-r--r-- | apps/playlist.c | 10 |
1 files changed, 7 insertions, 3 deletions
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 */ } |