diff options
| author | 2021-03-22 21:00:48 -0300 | |
|---|---|---|
| committer | 2021-07-08 19:00:39 -0300 | |
| commit | f28dd32275c1feba4854abad30ff5e21a7b39440 (patch) | |
| tree | 8cb51136e8bcd03418ce71878cc0e7478606ff25 /src/common/thread_worker.h | |
| parent | Merge pull request #6539 from lat9nq/default-setting (diff) | |
| download | yuzu-f28dd32275c1feba4854abad30ff5e21a7b39440.tar.gz yuzu-f28dd32275c1feba4854abad30ff5e21a7b39440.tar.xz yuzu-f28dd32275c1feba4854abad30ff5e21a7b39440.zip | |
common/thread_worker: Add wait for requests method
Diffstat (limited to 'src/common/thread_worker.h')
| -rw-r--r-- | src/common/thread_worker.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/thread_worker.h b/src/common/thread_worker.h index f1859971f..7a6756eb5 100644 --- a/src/common/thread_worker.h +++ b/src/common/thread_worker.h | |||
| @@ -18,12 +18,14 @@ public: | |||
| 18 | explicit ThreadWorker(std::size_t num_workers, const std::string& name); | 18 | explicit ThreadWorker(std::size_t num_workers, const std::string& name); |
| 19 | ~ThreadWorker(); | 19 | ~ThreadWorker(); |
| 20 | void QueueWork(std::function<void()>&& work); | 20 | void QueueWork(std::function<void()>&& work); |
| 21 | void WaitForRequests(); | ||
| 21 | 22 | ||
| 22 | private: | 23 | private: |
| 23 | std::vector<std::thread> threads; | 24 | std::vector<std::thread> threads; |
| 24 | std::queue<std::function<void()>> requests; | 25 | std::queue<std::function<void()>> requests; |
| 25 | std::mutex queue_mutex; | 26 | std::mutex queue_mutex; |
| 26 | std::condition_variable condition; | 27 | std::condition_variable condition; |
| 28 | std::condition_variable wait_condition; | ||
| 27 | std::atomic_bool stop{}; | 29 | std::atomic_bool stop{}; |
| 28 | }; | 30 | }; |
| 29 | 31 | ||