diff --git a/runloop.c b/runloop.c index 8ec5739ac3..dda17d06c7 100644 --- a/runloop.c +++ b/runloop.c @@ -106,9 +106,7 @@ const char *runloop_msg_queue_pull(void) const char *ret = NULL; runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_LOCK, NULL); - - ret = msg_queue_pull(g_msg_queue); - + runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_PULL, &ret); runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_UNLOCK, NULL); return ret; @@ -940,6 +938,14 @@ 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; + *ret = msg_queue_pull(g_msg_queue); + } + return true; case RUNLOOP_CTL_MSG_QUEUE_FREE: #ifdef HAVE_THREADS slock_free(runloop_msg_queue_lock); diff --git a/runloop.h b/runloop.h index dcbe40c1f2..f008c3b939 100644 --- a/runloop.h +++ b/runloop.h @@ -100,6 +100,7 @@ enum runloop_ctl_state RUNLOOP_CTL_MSG_QUEUE_LOCK, RUNLOOP_CTL_MSG_QUEUE_UNLOCK, RUNLOOP_CTL_MSG_QUEUE_FREE, + RUNLOOP_CTL_MSG_QUEUE_PULL, RUNLOOP_CTL_HAS_CORE_OPTIONS, RUNLOOP_CTL_GET_CORE_OPTION_SIZE, RUNLOOP_CTL_IS_CORE_OPTION_UPDATED,