Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make game size calculation not affect UI responsiveness #13134

Merged
merged 7 commits into from
Dec 30, 2022

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Dec 27, 2022

Attempt to improve #13127

@Megamouse
Copy link
Contributor

This only seems to speed up the cancel process.
How is this making it "truly async" any more than it already is?

@elad335 elad335 changed the title [Need Test] Make game size calculation truly async [Need Test] Make game size calculation not affect UI resposiveness Dec 27, 2022
@elad335
Copy link
Contributor Author

elad335 commented Dec 27, 2022

Okay.

@elad335 elad335 changed the title [Need Test] Make game size calculation not affect UI resposiveness [Need Test] Make game size calculation not affect UI responsiveness Dec 27, 2022
@@ -1831,7 +1831,7 @@ bool fs::remove_all(const std::string& path, bool remove_root, bool is_no_dir_ok
return true;
}

u64 fs::get_dir_size(const std::string& path, u64 rounding_alignment)
u64 fs::get_dir_size(const std::string& path, u64 rounding_alignment, atomic_t<bool>* cancel_flag)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not pass a shared_ptr?

Copy link
Contributor Author

@elad335 elad335 Dec 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a reason to force it here, it only limits design choices.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One reason would be to prevent regressions or edge cases that lead to the destruction of the source pointer before the threads are finished.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lambda captures the shared pointer by value not reference, it is destructed when the lambda itself is destructed (the code inside would be unreachable). As long as any shared pointer instance references the address, the address would not be deallocated.

@elad335 elad335 changed the title [Need Test] Make game size calculation not affect UI responsiveness Make game size calculation not affect UI responsiveness Dec 27, 2022
@Megamouse Megamouse merged commit 382a27c into RPCS3:master Dec 30, 2022
@elad335 elad335 deleted the patch-12 branch May 6, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants