MCPcopy Create free account
hub / github.com/MicrosoftEdge/WebView2Samples / WaitForOtherThreads

Function WaitForOtherThreads

SampleApps/WebView2APISample/App.cpp:196–221  ·  view source on GitHub ↗

Called on the main thread. Wait for all other threads to complete before exiting.

Source from the content-addressed store, hash-verified

194
195// Called on the main thread. Wait for all other threads to complete before exiting.
196static void WaitForOtherThreads()
197{
198 while (!s_threads.empty())
199 {
200 std::vector<HANDLE> threadHandles;
201 for (auto it = s_threads.begin(); it != s_threads.end(); ++it)
202 {
203 threadHandles.push_back(it->second);
204 }
205
206 HANDLE* handleArray = threadHandles.data();
207 DWORD dwIndex = MsgWaitForMultipleObjects(
208 static_cast<DWORD>(threadHandles.size()), threadHandles.data(), FALSE, INFINITE,
209 QS_ALLEVENTS);
210
211 if (dwIndex == WAIT_OBJECT_0 + threadHandles.size())
212 {
213 MSG msg;
214 while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
215 {
216 TranslateMessage(&msg);
217 DispatchMessage(&msg);
218 }
219 }
220 }
221}

Callers 1

wWinMainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected