mirror of
https://github.com/libretro/RetroArch
synced 2025-02-28 12:40:23 +00:00
Add TASK_CTL_PUSH
This commit is contained in:
parent
0764b65dc4
commit
b807b89837
@ -581,7 +581,7 @@ bool rarch_task_push_dbscan(const char *fullpath, bool directory, rarch_task_cal
|
||||
if (db->handle)
|
||||
db->handle->status = DATABASE_STATUS_ITERATE_BEGIN;
|
||||
|
||||
rarch_task_push(t);
|
||||
task_ctl(TASK_CTL_PUSH, t);
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -294,7 +294,7 @@ bool rarch_task_push_decompress(
|
||||
snprintf(tmp, sizeof(tmp), "%s '%s'", msg_hash_to_str(MSG_EXTRACTING), path_basename(source_file));
|
||||
t->title = strdup(tmp);
|
||||
|
||||
rarch_task_push(t);
|
||||
task_ctl(TASK_CTL_PUSH, t);
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -360,7 +360,7 @@ bool rarch_task_push_image_load(const char *fullpath, const char *type, rarch_ta
|
||||
t->callback = cb;
|
||||
t->user_data = user_data;
|
||||
|
||||
rarch_task_push(t);
|
||||
task_ctl(TASK_CTL_PUSH, t);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ bool rarch_task_push_http_transfer(const char *url, const char *type, rarch_task
|
||||
snprintf(tmp, sizeof(tmp), "%s '%s'", msg_hash_to_str(MSG_DOWNLOADING), path_basename(url));
|
||||
t->title = strdup(tmp);
|
||||
|
||||
rarch_task_push(t);
|
||||
task_ctl(TASK_CTL_PUSH, t);
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -714,7 +714,7 @@ static bool rarch_task_push_overlay_load(const char *overlay_path,
|
||||
t->callback = cb;
|
||||
t->user_data = user_data;
|
||||
|
||||
rarch_task_push(t);
|
||||
task_ctl(TASK_CTL_PUSH, t);
|
||||
|
||||
return true;
|
||||
error:
|
||||
|
@ -407,13 +407,6 @@ void rarch_task_check(void)
|
||||
impl_current->gather();
|
||||
}
|
||||
|
||||
/* The lack of NULL checks in the following functions is proposital
|
||||
* to ensure correct control flow by the users. */
|
||||
void rarch_task_push(rarch_task_t *task)
|
||||
{
|
||||
impl_current->push_running(task);
|
||||
}
|
||||
|
||||
bool rarch_task_find(rarch_task_finder_t func, void *user_data)
|
||||
{
|
||||
return impl_current->find(func, user_data);
|
||||
@ -423,6 +416,14 @@ bool task_ctl(enum task_ctl_state state, void *data)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case TASK_CTL_PUSH:
|
||||
{
|
||||
/* The lack of NULL checks in the following functions is proposital
|
||||
* to ensure correct control flow by the users. */
|
||||
rarch_task_t *task = (rarch_task_t*)data;
|
||||
impl_current->push_running(task);
|
||||
break;
|
||||
}
|
||||
case TASK_CTL_RESET:
|
||||
impl_current->reset();
|
||||
break;
|
||||
|
@ -33,6 +33,10 @@ enum task_ctl_state
|
||||
* This must only be called from the main thread. */
|
||||
TASK_CTL_WAIT,
|
||||
|
||||
/* Pushes a task
|
||||
* The task will start as soon as possible. */
|
||||
TASK_CTL_PUSH,
|
||||
|
||||
/* Sends a signal to terminate all the tasks.
|
||||
*
|
||||
* This won't terminate the tasks immediately.
|
||||
@ -119,15 +123,6 @@ void rarch_task_check(void);
|
||||
*/
|
||||
bool rarch_task_find(rarch_task_finder_t func, void *user_data);
|
||||
|
||||
/**
|
||||
* @brief Pushes a task
|
||||
*
|
||||
* The task will start as soon as possible.
|
||||
*
|
||||
* @param task
|
||||
*/
|
||||
void rarch_task_push(rarch_task_t *task);
|
||||
|
||||
#ifdef HAVE_NETWORKING
|
||||
typedef struct {
|
||||
char *data;
|
||||
|
Loading…
x
Reference in New Issue
Block a user