Create RUNLOOP_CTL_MSG_QUEUE_PULL

This commit is contained in:
twinaphex 2016-02-03 17:48:01 +01:00
parent c57995b3eb
commit 7803b0d925
2 changed files with 10 additions and 3 deletions

View File

@ -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);

View File

@ -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,