MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / processTasksAsync

Method processTasksAsync

src/gui2/imhex_overrides/splash_window.cpp:204–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202 }
203
204 std::future<bool> WindowSplash::processTasksAsync() {
205 return std::async(std::launch::async, [this] {
206 TaskManager::setCurrentThreadName("Init Tasks");
207
208 auto startTime = std::chrono::high_resolution_clock::now();
209
210 // Check every 10ms if all tasks have run
211 while (true) {
212 // Loop over all registered init tasks
213 for (auto it = m_tasks.begin(); it != m_tasks.end(); ++it) {
214 // Construct a new task callback
215 if (!it->running) {
216 this->createTask(*it);
217 it->running = true;
218 }
219 }
220
221 {
222 std::scoped_lock lock(m_tasksMutex);
223 if (m_completedTaskCount >= m_totalTaskCount)
224 break;
225 }
226
227 std::this_thread::sleep_for(10ms);
228 }
229
230 auto endTime = std::chrono::high_resolution_clock::now();
231
232 auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count();
233 log::info("ImHex fully started in {}ms", milliseconds);
234
235 // Small extra delay so the last progress step is visible
236 m_progressLerp = 1.0F;
237 std::this_thread::sleep_for(100ms);
238
239 return m_taskStatus.load();
240 });
241 }
242
243
244 void WindowSplash::fullFrame() {

Callers

nothing calls this directly

Calls 5

createTaskMethod · 0.95
loadMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected