Create wrapper functions for initing the runloop message queue

and freeing it
This commit is contained in:
twinaphex 2015-03-15 03:10:45 +01:00
parent e378962724
commit 8c1045c1ae
3 changed files with 19 additions and 5 deletions

View File

@ -2631,14 +2631,11 @@ bool rarch_main_command(unsigned cmd)
rarch_main_command(RARCH_CMD_AUTOSAVE_INIT);
break;
case RARCH_CMD_MSG_QUEUE_DEINIT:
if (g_runloop.msg_queue)
msg_queue_free(g_runloop.msg_queue);
g_runloop.msg_queue = NULL;
rarch_main_msg_queue_free();
break;
case RARCH_CMD_MSG_QUEUE_INIT:
rarch_main_command(RARCH_CMD_MSG_QUEUE_DEINIT);
if (!g_runloop.msg_queue)
rarch_assert(g_runloop.msg_queue = msg_queue_new(8));
rarch_main_msg_queue_init();
rarch_main_data_init_queues();
break;
case RARCH_CMD_BSV_MOVIE_DEINIT:

View File

@ -908,6 +908,19 @@ void rarch_main_msg_queue_push(const char *msg, unsigned prio, unsigned duration
msg_queue_push(g_runloop.msg_queue, msg, prio, duration);
}
void rarch_main_msg_queue_free(void)
{
if (g_runloop.msg_queue)
msg_queue_free(g_runloop.msg_queue);
g_runloop.msg_queue = NULL;
}
void rarch_main_msg_queue_init(void)
{
if (!g_runloop.msg_queue)
rarch_assert(g_runloop.msg_queue = msg_queue_new(8));
}
/**
* rarch_main_iterate:
*

View File

@ -181,6 +181,10 @@ void rarch_main_msg_queue_push(const char *msg, unsigned prio,
const char *rarch_main_msg_queue_pull(void);
void rarch_main_msg_queue_free(void);
void rarch_main_msg_queue_init(void);
void rarch_main_data_iterate(void);
void rarch_main_data_init_queues(void);