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

Various WorkQueueThread improvements #11539

Merged
merged 10 commits into from Feb 9, 2023

Conversation

phire
Copy link
Member

@phire phire commented Feb 4, 2023

Various improvements to WorkQueueThread

Pulled out of #11473 and #11417, a combination of work by both me and @K0bin

Changes:

  • Added WaitForCompletion (needed by both PRs)
  • The threads now have proper names
  • Changed cancel semantics to meet requirements of the present wait PR
  • Rewrote the whole thing directly with condition vars instead of using Common::Event.

phire and others added 6 commits February 4, 2023 14:31
and rename the existing Flush to FlushOne.
Otherwise we will end up with a dozen threads named "WorkQueueThread"
 - Cancel doesn't shut down anymore.
   Allowing it to be used multiple times thoughout the life of
   the WorkQueue
 - Remove Clear, so we only have Cancel semantics
 - Add IsCancelling so work items can abort early if cancelling
 - Replace m_cancelled and m_thread.joinable() guars with m_shutdown.
 - Rename Flush to WaitForCompletion (As it's ambiguous if a function
   called flush should be blocking or not)
 - Add documentation
Adjust shutdown order to prevent potential deadlocks
when one thread calls Shutdown, and another calls WaitForCompletion.
m_items.empty() is by far the most likely reason for a notification.
@phire phire merged commit aaad0cd into dolphin-emu:master Feb 9, 2023
14 checks passed
@phire phire deleted the improve_workqueuethread branch February 9, 2023 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants