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
This commit is contained in:
Aidan MacDonald 2023-01-16 11:55:59 +00:00
parent a9b93bb4cd
commit aae34b2e7f

View file

@ -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);
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 */
}