Don't make async_jobs dependent on global state anymore

This commit is contained in:
twinaphex 2015-12-06 18:37:57 +01:00
parent 4e14e6e6fa
commit d33f0b5239
3 changed files with 23 additions and 15 deletions

View File

@ -34,7 +34,6 @@
#include "verbosity.h"
enum
{
CHEEVOS_VAR_SIZE_BIT_0,
@ -175,6 +174,10 @@ cheevos_globals_t cheevos_globals =
0
};
/* forward declaration */
int rarch_main_async_job_add(async_task_t task, void *payload);
/*****************************************************************************
Supporting functions.
*****************************************************************************/
@ -1245,7 +1248,7 @@ static void cheevos_unlocker(void *payload)
else
{
RARCH_LOG("CHEEVOS error awarding achievement %u, will retry\n", cheevo_id);
async_job_add(global->async_jobs, cheevos_unlocker, (void*)(uintptr_t)cheevo_id);
rarch_main_async_job_add(cheevos_unlocker, (void*)(uintptr_t)cheevo_id);
}
}
}
@ -1266,7 +1269,7 @@ static void cheevos_test_cheevo_set(const cheevoset_t *set)
rarch_main_msg_queue_push(cheevo->title, 0, 3 * 60, false);
rarch_main_msg_queue_push(cheevo->description, 0, 5 * 60, false);
async_job_add(global->async_jobs, cheevos_unlocker, (void*)(uintptr_t)cheevo->id);
rarch_main_async_job_add(cheevos_unlocker, (void*)(uintptr_t)cheevo->id);
cheevo->active = 0;
}
@ -1435,7 +1438,7 @@ static void cheevos_playing(void *payload)
else
{
RARCH_LOG("CHEEVOS error posting playing game %u activity, will retry\n", game_id);
async_job_add(global->async_jobs, cheevos_playing, (void*)(uintptr_t)game_id);
rarch_main_async_job_add(cheevos_playing, (void*)(uintptr_t)game_id);
}
}
}
@ -1915,7 +1918,7 @@ int cheevos_load(const struct retro_game_info *info)
free((void*)json);
cheevos_locals.loaded = 1;
async_job_add(global->async_jobs, cheevos_playing, (void*)(uintptr_t)game_id);
rarch_main_async_job_add(cheevos_playing, (void*)(uintptr_t)game_id);
return 0;
}

View File

@ -18,7 +18,10 @@
#include <file/file_path.h>
#include <retro_assert.h>
#include <retro_stat.h>
#ifdef HAVE_THREADS
#include <rthreads/async_job.h>
#endif
#include "frontend.h"
#include "../ui/ui_companion_driver.h"
@ -37,6 +40,15 @@
#define MAX_ARGS 32
#ifdef HAVE_THREADS
static async_job_t *async_jobs;
int rarch_main_async_job_add(async_task_t task, void *payload)
{
return async_job_add(async_jobs, task, payload);
}
#endif
/**
* main_exit:
*
@ -258,8 +270,7 @@ int rarch_main(int argc, char *argv[], void *data)
rarch_main_new();
#ifdef HAVE_THREADS
global = global_get_ptr();
global->async_jobs = async_job_new();
async_jobs = async_job_new();
#endif
if (frontend_driver_is_inited())
@ -306,8 +317,8 @@ int rarch_main(int argc, char *argv[], void *data)
#endif
#ifdef HAVE_THREADS
async_job_free(global->async_jobs);
global->async_jobs = NULL;
async_job_free(async_jobs);
async_jobs = NULL;
#endif
return 0;

View File

@ -16,8 +16,6 @@
#ifndef __RETROARCH_RUNLOOP_H
#define __RETROARCH_RUNLOOP_H
#include <rthreads/async_job.h>
#include "libretro.h"
#include "core_info.h"
#include "core_options.h"
@ -272,10 +270,6 @@ typedef struct global
bool softfilter_enable;
} console;
#ifdef HAVE_THREADS
async_job_t *async_jobs;
#endif
struct
{
bool main;