-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
|
This only seems to speed up the cancel process. |
|
Okay. |
| @@ -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) | |||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Attempt to improve #13127