diff options
Diffstat (limited to '')
| -rw-r--r-- | src/common/thread_worker.cpp | 9 |
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) { | |||
| 12 | const auto lambda = [this, thread_name{std::string{name}}] { | 12 | const auto lambda = [this, thread_name{std::string{name}}] { |
| 13 | Common::SetCurrentThreadName(thread_name.c_str()); | 13 | Common::SetCurrentThreadName(thread_name.c_str()); |
| 14 | 14 | ||
| 15 | // TODO(Blinkhawk): Change the design, this is very prone to data races | ||
| 16 | // Wait for first request | ||
| 17 | { | ||
| 18 | std::unique_lock lock{queue_mutex}; | ||
| 19 | condition.wait(lock, [this] { return stop || !requests.empty(); }); | ||
| 20 | } | ||
| 21 | |||
| 22 | while (!stop) { | 15 | while (!stop) { |
| 23 | UniqueFunction<void> task; | 16 | UniqueFunction<void> task; |
| 24 | { | 17 | { |
| @@ -27,7 +20,7 @@ ThreadWorker::ThreadWorker(std::size_t num_workers, const std::string& name) { | |||
| 27 | wait_condition.notify_all(); | 20 | wait_condition.notify_all(); |
| 28 | } | 21 | } |
| 29 | condition.wait(lock, [this] { return stop || !requests.empty(); }); | 22 | condition.wait(lock, [this] { return stop || !requests.empty(); }); |
| 30 | if (stop || requests.empty()) { | 23 | if (stop) { |
| 31 | break; | 24 | break; |
| 32 | } | 25 | } |
| 33 | task = std::move(requests.front()); | 26 | task = std::move(requests.front()); |