Split up retro::task::deinit into wait and reset

This commit is contained in:
Jesse Talavera-Greenberg 2023-08-24 22:18:30 -04:00
parent f4a9887e79
commit 0dc65bf435
3 changed files with 14 additions and 2 deletions

View File

@ -440,6 +440,8 @@ PUBLIC_SYMBOL void retro_unload_game(void) {
// No need to flush the homebrew save data either, the CartHomebrew destructor does that
// The cleanup handlers for each task will flush data to disk if needed
retro::task::reset();
retro::task::wait();
retro::task::deinit();
if (NDS::Running)

View File

@ -44,13 +44,21 @@ void retro::task::push(TaskSpec&& task) noexcept {
task._task = nullptr;
}
void retro::task::wait() noexcept {
ZoneScopedN("retro::task::wait");
task_queue_wait(nullptr, nullptr); // wait for all tasks to finish
}
void retro::task::deinit() noexcept {
ZoneScopedN("retro::task::deinit");
task_queue_reset(); // cancel all outstanding tasks
task_queue_wait(nullptr, nullptr); // wait for all tasks to finish
task_queue_deinit();
}
void retro::task::reset() noexcept {
ZoneScopedN("retro::task::reset");
task_queue_reset(); // cancel all outstanding tasks
}
void retro::task::check() noexcept {
ZoneScopedN("retro::task::check");
task_queue_check();

View File

@ -35,7 +35,9 @@ namespace retro::task {
void push(TaskSpec&& task) noexcept;
void check() noexcept;
void reset() noexcept;
void deinit() noexcept;
void wait() noexcept;
class TaskSpec {
public: