(task_http.c) Some refactors

This commit is contained in:
twinaphex 2015-07-08 21:18:34 +02:00
parent 82f645ce51
commit 74627d1497
3 changed files with 26 additions and 3 deletions

View File

@ -295,8 +295,7 @@ void rarch_main_data_init_queues(void)
{
data_runloop_t *runloop = rarch_main_data_get_ptr();
#ifdef HAVE_NETWORKING
if (!runloop->http.msg_queue)
rarch_assert(runloop->http.msg_queue = msg_queue_new(8));
rarch_main_data_http_init_msg_queue();
#endif
rarch_main_data_nbio_init_msg_queue();
#ifdef HAVE_LIBRETRODB
@ -332,7 +331,7 @@ void rarch_main_data_msg_queue_push(unsigned type,
break;
#ifdef HAVE_NETWORKING
case DATA_TYPE_HTTP:
queue = runloop->http.msg_queue;
queue = rarch_main_data_http_get_msg_queue_ptr();
snprintf(new_msg, sizeof(new_msg), "%s|%s", msg, msg2);
break;
#endif

View File

@ -436,3 +436,23 @@ void rarch_main_data_http_iterate(bool is_thread, void *data)
break;
}
}
void rarch_main_data_http_init_msg_queue(void)
{
data_runloop_t *runloop = rarch_main_data_get_ptr();
http_handle_t *http = runloop ? &runloop->http : NULL;
if (!http)
return;
if (!http->msg_queue)
rarch_assert(http->msg_queue = msg_queue_new(8));
}
msg_queue_t *rarch_main_data_http_get_msg_queue_ptr(void)
{
data_runloop_t *runloop = rarch_main_data_get_ptr();
http_handle_t *http = runloop ? &runloop->http : NULL;
if (!http)
return NULL;
return http->msg_queue;
}

View File

@ -51,6 +51,10 @@ void *rarch_main_data_nbio_image_get_handle(void);
**/
void rarch_main_data_http_iterate(bool is_thread,
void *data);
msg_queue_t *rarch_main_data_http_get_msg_queue_ptr(void);
void rarch_main_data_http_init_msg_queue(void);
#endif
#ifdef HAVE_RPNG