summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2021-04-06 06:02:44 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2021-07-09 00:03:26 +0200
commitc147e9a90e92ceec17d778d3c6e5cf6f028109b3 (patch)
tree9b584776a83fe55eecb43941d8f070db4f9efc71 /src/common
parentcommon/thread_worker: Fix data race (diff)
downloadyuzu-c147e9a90e92ceec17d778d3c6e5cf6f028109b3.tar
yuzu-c147e9a90e92ceec17d778d3c6e5cf6f028109b3.tar.gz
yuzu-c147e9a90e92ceec17d778d3c6e5cf6f028109b3.tar.bz2
yuzu-c147e9a90e92ceec17d778d3c6e5cf6f028109b3.tar.lz
yuzu-c147e9a90e92ceec17d778d3c6e5cf6f028109b3.tar.xz
yuzu-c147e9a90e92ceec17d778d3c6e5cf6f028109b3.tar.zst
yuzu-c147e9a90e92ceec17d778d3c6e5cf6f028109b3.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/thread_worker.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/common/thread_worker.cpp b/src/common/thread_worker.cpp
index fd130dfb4..32be49b15 100644
--- a/src/common/thread_worker.cpp
+++ b/src/common/thread_worker.cpp
@@ -12,13 +12,6 @@ ThreadWorker::ThreadWorker(std::size_t num_workers, const std::string& name) {
const auto lambda = [this, thread_name{std::string{name}}] {
Common::SetCurrentThreadName(thread_name.c_str());
- // TODO(Blinkhawk): Change the design, this is very prone to data races
- // Wait for first request
- {
- std::unique_lock lock{queue_mutex};
- condition.wait(lock, [this] { return stop || !requests.empty(); });
- }
-
while (!stop) {
UniqueFunction<void> task;
{
@@ -27,7 +20,7 @@ ThreadWorker::ThreadWorker(std::size_t num_workers, const std::string& name) {
wait_condition.notify_all();
}
condition.wait(lock, [this] { return stop || !requests.empty(); });
- if (stop || requests.empty()) {
+ if (stop) {
break;
}
task = std::move(requests.front());