From dd8cae38ad21388127ba3f29ec342c10825c67e5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 23 Dec 2016 00:00:40 +0100 Subject: [PATCH] Simplify RUNLOOP_CTL_MESSAGE_QUEUE_PULL --- runloop.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/runloop.c b/runloop.c index 4c5863fcbd..118300f236 100644 --- a/runloop.c +++ b/runloop.c @@ -505,23 +505,18 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) case RUNLOOP_CTL_IS_PAUSED: return runloop_paused; case RUNLOOP_CTL_MSG_QUEUE_PULL: -#ifdef HAVE_THREADS - slock_lock(_runloop_msg_queue_lock); -#endif { const char **ret = (const char**)data; if (!ret) - { -#ifdef HAVE_THREADS - slock_unlock(_runloop_msg_queue_lock); -#endif return false; - } - *ret = msg_queue_pull(runloop_msg_queue); - } #ifdef HAVE_THREADS - slock_unlock(_runloop_msg_queue_lock); + 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)