| 23 | } |
| 24 | |
| 25 | XamlThreadPool::~XamlThreadPool() |
| 26 | { |
| 27 | if (const auto size = m_Threads.size(); size != 0) |
| 28 | { |
| 29 | std::vector<wil::unique_handle> threads; |
| 30 | threads.reserve(size); |
| 31 | |
| 32 | for (auto &xamlThread : m_Threads) |
| 33 | { |
| 34 | threads.push_back(xamlThread->Delete()); |
| 35 | static_cast<void>(xamlThread.release()); |
| 36 | } |
| 37 | |
| 38 | if (WaitForMultipleObjects(wil::safe_cast<DWORD>(size), threads.data()->addressof(), true, INFINITE) == WAIT_FAILED) |
| 39 | { |
| 40 | LastErrorHandle(spdlog::level::warn, L"Failed to wait for thread termination"); |
| 41 | } |
| 42 | } |
| 43 | } |