Create RUNLOOP_CTL_MSG_QUEUE_CLEAR

This commit is contained in:
twinaphex 2016-02-03 17:50:53 +01:00
parent 7803b0d925
commit e6d04b2fb4
2 changed files with 9 additions and 3 deletions

View File

@ -123,10 +123,9 @@ void runloop_msg_queue_push(const char *msg,
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_LOCK, NULL);
if (flush)
msg_queue_clear(g_msg_queue);
msg_queue_push(g_msg_queue, msg, prio, duration);
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_CLEAR, NULL);
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_UNLOCK, NULL);
msg_queue_push(g_msg_queue, msg, prio, duration);
if (ui_companion_is_on_foreground())
{
@ -134,6 +133,9 @@ void runloop_msg_queue_push(const char *msg,
if (ui->msg_queue_push)
ui->msg_queue_push(msg, prio, duration, flush);
}
runloop_ctl(RUNLOOP_CTL_MSG_QUEUE_UNLOCK, NULL);
}
#ifdef HAVE_MENU
@ -952,6 +954,9 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
runloop_msg_queue_lock = NULL;
#endif
break;
case RUNLOOP_CTL_MSG_QUEUE_CLEAR:
msg_queue_clear(g_msg_queue);
return true;
case RUNLOOP_CTL_MSG_QUEUE_DEINIT:
if (!g_msg_queue)
return true;

View File

@ -101,6 +101,7 @@ enum runloop_ctl_state
RUNLOOP_CTL_MSG_QUEUE_UNLOCK,
RUNLOOP_CTL_MSG_QUEUE_FREE,
RUNLOOP_CTL_MSG_QUEUE_PULL,
RUNLOOP_CTL_MSG_QUEUE_CLEAR,
RUNLOOP_CTL_HAS_CORE_OPTIONS,
RUNLOOP_CTL_GET_CORE_OPTION_SIZE,
RUNLOOP_CTL_IS_CORE_OPTION_UPDATED,