diff --git a/libretro-common/include/queues/task_queue.h b/libretro-common/include/queues/task_queue.h index 2825928577..793eb5403a 100644 --- a/libretro-common/include/queues/task_queue.h +++ b/libretro-common/include/queues/task_queue.h @@ -32,14 +32,14 @@ extern "C" { enum task_queue_ctl_state { - TASK_CTL_NONE = 0, + TASK_QUEUE_CTL_NONE = 0, /* Deinitializes the task system. * This deinitializes the task system. * The tasks that are running at * the moment will stay on hold - * until TASK_CTL_INIT is called again. */ - TASK_CTL_DEINIT, + * until TASK_QUEUE_CTL_INIT is called again. */ + TASK_QUEUE_CTL_DEINIT, /* Initializes the task system. * This initializes the task system @@ -47,28 +47,28 @@ enum task_queue_ctl_state * implementation according to the settings. * * This must only be called from the main thread. */ - TASK_CTL_INIT, + TASK_QUEUE_CTL_INIT, /** * Calls func for every running task * until it returns true. * Returns a task or NULL if not found. */ - TASK_CTL_FIND, + TASK_QUEUE_CTL_FIND, /* Blocks until all tasks have finished. * This must only be called from the main thread. */ - TASK_CTL_WAIT, + TASK_QUEUE_CTL_WAIT, /* Checks for finished tasks * Takes the finished tasks, if any, * and runs their callbacks. * This must only be called from the main thread. */ - TASK_CTL_CHECK, + TASK_QUEUE_CTL_CHECK, /* Pushes a task * The task will start as soon as possible. */ - TASK_CTL_PUSH, + TASK_QUEUE_CTL_PUSH, /* Sends a signal to terminate all the tasks. * @@ -76,13 +76,13 @@ enum task_queue_ctl_state * They will finish as soon as possible. * * This must only be called from the main thread. */ - TASK_CTL_RESET, + TASK_QUEUE_CTL_RESET, - TASK_CTL_SET_THREADED, + TASK_QUEUE_CTL_SET_THREADED, - TASK_CTL_UNSET_THREADED, + TASK_QUEUE_CTL_UNSET_THREADED, - TASK_CTL_IS_THREADED + TASK_QUEUE_CTL_IS_THREADED }; typedef struct retro_task retro_task_t; diff --git a/libretro-common/queues/task_queue.c b/libretro-common/queues/task_queue.c index 3c8c1f112e..374dcc7611 100644 --- a/libretro-common/queues/task_queue.c +++ b/libretro-common/queues/task_queue.c @@ -383,20 +383,20 @@ bool task_queue_ctl(enum task_queue_ctl_state state, void *data) switch (state) { - case TASK_CTL_DEINIT: + case TASK_QUEUE_CTL_DEINIT: if (impl_current) impl_current->deinit(); impl_current = NULL; break; - case TASK_CTL_SET_THREADED: + case TASK_QUEUE_CTL_SET_THREADED: task_threaded_enable = true; break; - case TASK_CTL_UNSET_THREADED: + case TASK_QUEUE_CTL_UNSET_THREADED: task_threaded_enable = false; break; - case TASK_CTL_IS_THREADED: + case TASK_QUEUE_CTL_IS_THREADED: return task_threaded_enable; - case TASK_CTL_INIT: + case TASK_QUEUE_CTL_INIT: { bool *boolean_val = (bool*)data; @@ -404,7 +404,7 @@ bool task_queue_ctl(enum task_queue_ctl_state state, void *data) #ifdef HAVE_THREADS if (*boolean_val) { - task_queue_ctl(TASK_CTL_SET_THREADED, NULL); + task_queue_ctl(TASK_QUEUE_CTL_SET_THREADED, NULL); impl_current = &impl_threaded; } #endif @@ -412,30 +412,31 @@ bool task_queue_ctl(enum task_queue_ctl_state state, void *data) impl_current->init(); } break; - case TASK_CTL_FIND: + case TASK_QUEUE_CTL_FIND: { task_finder_data_t *find_data = (task_finder_data_t*)data; if (!impl_current->find(find_data->func, find_data->userdata)) return false; } break; - case TASK_CTL_CHECK: + case TASK_QUEUE_CTL_CHECK: { #ifdef HAVE_THREADS bool current_threaded = (impl_current == &impl_threaded); - bool want_threaded = task_queue_ctl(TASK_CTL_IS_THREADED, NULL); + bool want_threaded = + task_queue_ctl(TASK_QUEUE_CTL_IS_THREADED, NULL); if (want_threaded != current_threaded) - task_queue_ctl(TASK_CTL_DEINIT, NULL); + task_queue_ctl(TASK_QUEUE_CTL_DEINIT, NULL); if (!impl_current) - task_queue_ctl(TASK_CTL_INIT, NULL); + task_queue_ctl(TASK_QUEUE_CTL_INIT, NULL); #endif impl_current->gather(); } break; - case TASK_CTL_PUSH: + case TASK_QUEUE_CTL_PUSH: { /* The lack of NULL checks in the following functions * is proposital to ensure correct control flow by the users. */ @@ -443,13 +444,13 @@ bool task_queue_ctl(enum task_queue_ctl_state state, void *data) impl_current->push_running(task); break; } - case TASK_CTL_RESET: + case TASK_QUEUE_CTL_RESET: impl_current->reset(); break; - case TASK_CTL_WAIT: + case TASK_QUEUE_CTL_WAIT: impl_current->wait(); break; - case TASK_CTL_NONE: + case TASK_QUEUE_CTL_NONE: default: break; } diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 7c212179d1..044e776669 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2826,9 +2826,9 @@ void general_write_handler(void *data) case MENU_LABEL_VIDEO_THREADED: { if (*setting->value.boolean) - task_queue_ctl(TASK_CTL_SET_THREADED, NULL); + task_queue_ctl(TASK_QUEUE_CTL_SET_THREADED, NULL); else - task_queue_ctl(TASK_CTL_UNSET_THREADED, NULL); + task_queue_ctl(TASK_QUEUE_CTL_UNSET_THREADED, NULL); } break; case MENU_LABEL_INPUT_POLL_TYPE_BEHAVIOR: diff --git a/runloop.c b/runloop.c index 6816b164a2..8ddce7906a 100644 --- a/runloop.c +++ b/runloop.c @@ -439,7 +439,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) switch (state) { case RUNLOOP_CTL_DATA_ITERATE: - task_queue_ctl(TASK_CTL_CHECK, NULL); + task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL); return true; case RUNLOOP_CTL_SHADER_DIR_DEINIT: shader_dir_free(&runloop_shader_dir); @@ -973,7 +973,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) case RUNLOOP_CTL_TASK_INIT: { bool threaded_enable = settings->threaded_data_runloop_enable; - task_queue_ctl(TASK_CTL_INIT, &threaded_enable); + task_queue_ctl(TASK_QUEUE_CTL_INIT, &threaded_enable); } break; case RUNLOOP_CTL_PREPARE_DUMMY: @@ -1011,7 +1011,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) case RUNLOOP_CTL_IS_EXEC: return runloop_exec; case RUNLOOP_CTL_DATA_DEINIT: - task_queue_ctl(TASK_CTL_DEINIT, NULL); + task_queue_ctl(TASK_QUEUE_CTL_DEINIT, NULL); break; case RUNLOOP_CTL_IS_CORE_OPTION_UPDATED: if (!runloop_system.core_options) diff --git a/tasks/task_database.c b/tasks/task_database.c index 6e9707288b..c1cd5d4a41 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -607,7 +607,7 @@ bool rarch_task_push_dbscan(const char *fullpath, if (db->handle) db->handle->status = DATABASE_STATUS_ITERATE_BEGIN; - task_queue_ctl(TASK_CTL_PUSH, t); + task_queue_ctl(TASK_QUEUE_CTL_PUSH, t); return true; diff --git a/tasks/task_decompress.c b/tasks/task_decompress.c index 7960919a7f..f31e79c2d4 100644 --- a/tasks/task_decompress.c +++ b/tasks/task_decompress.c @@ -266,7 +266,7 @@ bool rarch_task_push_decompress( find_data.func = rarch_task_decompress_finder; find_data.userdata = (void*)source_file; - if (task_queue_ctl(TASK_CTL_FIND, &find_data)) + if (task_queue_ctl(TASK_QUEUE_CTL_FIND, &find_data)) { RARCH_LOG("[decompress] File '%s' already being decompressed.\n", source_file); @@ -313,7 +313,7 @@ bool rarch_task_push_decompress( t->title = strdup(tmp); - task_queue_ctl(TASK_CTL_PUSH, t); + task_queue_ctl(TASK_QUEUE_CTL_PUSH, t); return true; diff --git a/tasks/task_file_transfer.c b/tasks/task_file_transfer.c index 1abe616769..5c7cd02ed7 100644 --- a/tasks/task_file_transfer.c +++ b/tasks/task_file_transfer.c @@ -363,7 +363,7 @@ bool rarch_task_push_image_load(const char *fullpath, t->callback = cb; t->user_data = user_data; - task_queue_ctl(TASK_CTL_PUSH, t); + task_queue_ctl(TASK_QUEUE_CTL_PUSH, t); #endif return true; } diff --git a/tasks/task_http.c b/tasks/task_http.c index 4382f07313..69e5753804 100644 --- a/tasks/task_http.c +++ b/tasks/task_http.c @@ -226,7 +226,7 @@ bool rarch_task_push_http_transfer(const char *url, const char *type, find_data.userdata = (void*)url; /* Concurrent download of the same file is not allowed */ - if (task_queue_ctl(TASK_CTL_FIND, &find_data)) + if (task_queue_ctl(TASK_QUEUE_CTL_FIND, &find_data)) { RARCH_LOG("[http] '%s'' is already being downloaded.\n", url); return false; @@ -265,7 +265,7 @@ bool rarch_task_push_http_transfer(const char *url, const char *type, t->title = strdup(tmp); - task_queue_ctl(TASK_CTL_PUSH, t); + task_queue_ctl(TASK_QUEUE_CTL_PUSH, t); return true; diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c index c98c000bd3..ab34f39f35 100644 --- a/tasks/task_overlay.c +++ b/tasks/task_overlay.c @@ -732,7 +732,7 @@ static bool rarch_task_push_overlay_load(const char *overlay_path, t->callback = cb; t->user_data = user_data; - task_queue_ctl(TASK_CTL_PUSH, t); + task_queue_ctl(TASK_QUEUE_CTL_PUSH, t); return true; error: