mirror of
https://github.com/rt64/rt64.git
synced 2024-12-26 21:18:31 +00:00
Wait for texture streaming threads to finish before exiting.
This commit is contained in:
parent
09f7ac21d0
commit
8d6b2621f7
@ -471,7 +471,7 @@ namespace RT64 {
|
|||||||
uploadResourcePool = directWorker->device->createPool(poolDesc);
|
uploadResourcePool = directWorker->device->createPool(poolDesc);
|
||||||
|
|
||||||
// Create upload thread.
|
// Create upload thread.
|
||||||
uploadThread = new std::thread(&TextureCache::uploadThreadLoop, this);
|
uploadThread = std::make_unique<std::thread>(&TextureCache::uploadThreadLoop, this);
|
||||||
|
|
||||||
// Create streaming threads.
|
// Create streaming threads.
|
||||||
streamDescStackActiveCount = threadCount;
|
streamDescStackActiveCount = threadCount;
|
||||||
@ -482,11 +482,14 @@ namespace RT64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TextureCache::~TextureCache() {
|
TextureCache::~TextureCache() {
|
||||||
|
waitForAllStreamThreads(true);
|
||||||
|
streamThreads.clear();
|
||||||
|
|
||||||
if (uploadThread != nullptr) {
|
if (uploadThread != nullptr) {
|
||||||
uploadThreadRunning = false;
|
uploadThreadRunning = false;
|
||||||
uploadQueueChanged.notify_all();
|
uploadQueueChanged.notify_all();
|
||||||
uploadThread->join();
|
uploadThread->join();
|
||||||
delete uploadThread;
|
uploadThread.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
descriptorSets.clear();
|
descriptorSets.clear();
|
||||||
|
@ -203,7 +203,7 @@ namespace RT64 {
|
|||||||
std::mutex uploadQueueMutex;
|
std::mutex uploadQueueMutex;
|
||||||
std::condition_variable uploadQueueChanged;
|
std::condition_variable uploadQueueChanged;
|
||||||
std::condition_variable uploadQueueFinished;
|
std::condition_variable uploadQueueFinished;
|
||||||
std::thread *uploadThread;
|
std::unique_ptr<std::thread> uploadThread;
|
||||||
std::atomic<bool> uploadThreadRunning;
|
std::atomic<bool> uploadThreadRunning;
|
||||||
std::stack<StreamDescription> streamDescStack;
|
std::stack<StreamDescription> streamDescStack;
|
||||||
std::mutex streamDescStackMutex;
|
std::mutex streamDescStackMutex;
|
||||||
|
Loading…
Reference in New Issue
Block a user