diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 5211b90ab9..f946bf1425 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2184,8 +2184,9 @@ void video_driver_frame(const void *data, unsigned width, video_driver_msg[0] = '\0'; - if (runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_PULL, &msg) - && video_info.font_enable && msg) + if ( video_info.font_enable + && runloop_msg_queue_pull((const char**)&msg) + && msg) strlcpy(video_driver_msg, msg, sizeof(video_driver_msg)); if (!current_video || !current_video->frame( diff --git a/runloop.c b/runloop.c index 590e4b3a8d..6d48044033 100644 --- a/runloop.c +++ b/runloop.c @@ -212,6 +212,20 @@ void runloop_get_status(bool *is_paused, bool *is_idle, *is_slowmotion = runloop_slowmotion; } +bool runloop_msg_queue_pull(const char **ret) +{ + if (!ret) + return false; +#ifdef HAVE_THREADS + slock_lock(_runloop_msg_queue_lock); +#endif + *ret = msg_queue_pull(runloop_msg_queue); +#ifdef HAVE_THREADS + slock_unlock(_runloop_msg_queue_lock); +#endif + return true; +} + bool runloop_ctl(enum runloop_ctl_state state, void *data) { @@ -455,20 +469,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) break; case RUNLOOP_CTL_IS_PAUSED: return runloop_paused; - case RUNLOOP_CTL_MSG_QUEUE_PULL: - { - const char **ret = (const char**)data; - if (!ret) - return false; -#ifdef HAVE_THREADS - slock_lock(_runloop_msg_queue_lock); -#endif - *ret = msg_queue_pull(runloop_msg_queue); -#ifdef HAVE_THREADS - slock_unlock(_runloop_msg_queue_lock); -#endif - } - break; case RUNLOOP_CTL_MSG_QUEUE_DEINIT: if (!runloop_msg_queue) return true; diff --git a/runloop.h b/runloop.h index bca1433f45..107ad14a1c 100644 --- a/runloop.h +++ b/runloop.h @@ -93,7 +93,6 @@ enum runloop_ctl_state /* Message queue */ RUNLOOP_CTL_MSG_QUEUE_INIT, RUNLOOP_CTL_MSG_QUEUE_DEINIT, - RUNLOOP_CTL_MSG_QUEUE_PULL, /* Core options */ RUNLOOP_CTL_HAS_CORE_OPTIONS, @@ -203,6 +202,8 @@ int runloop_iterate(unsigned *sleep_ms); void runloop_msg_queue_push(const char *msg, unsigned prio, unsigned duration, bool flush); +bool runloop_msg_queue_pull(const char **ret); + void runloop_get_status(bool *is_paused, bool *is_idle, bool *is_slowmotion); bool runloop_ctl(enum runloop_ctl_state state, void *data);