asyncResourceGatherer: do not detach worker threads (#477)

Worker threads become non-joinable once they are detached, and `await()` will not wait for them to
finish. This can lead to a crash when `asyncResourceGatherer` is destroyed in the main thread while it
is still being used in worker threads.
This commit is contained in:
Yang, Ying-chao 2024-09-05 03:58:38 +08:00 committed by GitHub
parent 73b0fc26c0
commit 0b030d33c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,10 +18,7 @@ CAsyncResourceGatherer::CAsyncResourceGatherer() {
enqueueDMAFrames();
initialGatherThread = std::thread([this]() { this->gather(); });
initialGatherThread.detach();
asyncLoopThread = std::thread([this]() { this->asyncAssetSpinLock(); });
asyncLoopThread.detach();
asyncLoopThread = std::thread([this]() { this->asyncAssetSpinLock(); });
}
void CAsyncResourceGatherer::enqueueDMAFrames() {