From b56eb3d1bc9ba6c553aa626bcc254b7837aab8ea Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 22 Aug 2015 18:21:00 +0200 Subject: [PATCH] rarch_main_data_msg_queue_push - in some cases, the data runloop thread is not yet set up when this is called, so make sure it is setup at the end of this call if so --- runloop_data.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/runloop_data.c b/runloop_data.c index e5e5dac232..a5bcc9eb69 100644 --- a/runloop_data.c +++ b/runloop_data.c @@ -181,6 +181,9 @@ static void data_thread_loop(void *data) #ifdef HAVE_THREADS static void rarch_main_data_thread_init(void) { + if (!g_data_runloop.thread_inited) + return; + g_data_runloop.lock = slock_new(); g_data_runloop.cond_lock = slock_new(); g_data_runloop.cond = scond_new(); @@ -311,6 +314,9 @@ void rarch_main_data_msg_queue_push(unsigned type, { char new_msg[PATH_MAX_LENGTH]; msg_queue_t *queue = NULL; + settings_t *settings = config_get_ptr(); + + (void)settings; switch(type) { @@ -349,6 +355,14 @@ void rarch_main_data_msg_queue_push(unsigned type, if (flush) msg_queue_clear(queue); msg_queue_push(queue, new_msg, prio, duration); + +#ifdef HAVE_THREADS + if (settings->menu.threaded_data_runloop_enable) + { + if (!g_data_runloop.thread_inited) + rarch_main_data_thread_init(); + } +#endif } void data_runloop_osd_msg(const char *msg, size_t len)