| 87 | } |
| 88 | |
| 89 | void DrawerThreads::WaitForWorkers() |
| 90 | { |
| 91 | using namespace std::chrono_literals; |
| 92 | |
| 93 | // Wait for workers to finish |
| 94 | auto queue = Instance(); |
| 95 | std::unique_lock<std::mutex> end_lock(queue->end_mutex); |
| 96 | if (!queue->end_condition.wait_for(end_lock, 5s, [&]() { return queue->tasks_left == 0; })) |
| 97 | { |
| 98 | I_FatalError("Drawer threads did not finish within 5 seconds!"); |
| 99 | } |
| 100 | end_lock.unlock(); |
| 101 | |
| 102 | // Clean up |
| 103 | std::unique_lock<std::mutex> start_lock(queue->start_mutex); |
| 104 | for (auto &thread : queue->threads) |
| 105 | thread.current_queue = 0; |
| 106 | |
| 107 | for (auto &list : queue->active_commands) |
| 108 | { |
| 109 | for (auto &command : list->commands) |
| 110 | command->~DrawerCommand(); |
| 111 | list->Clear(); |
| 112 | } |
| 113 | queue->active_commands.clear(); |
| 114 | } |
| 115 | |
| 116 | void DrawerThreads::WorkerMain(DrawerThread *thread) |
| 117 | { |
nothing calls this directly
no test coverage detected