Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 449 vs 515 for /trunk/Source Code/Platform/Video/GFXState.cpp

Diff revisions: vs.
  @@ -16,25 +16,32 @@
16 16 bool GPUState::startLoaderThread(const DELEGATE_CBK<>& loadingFunction) {
17 17 DIVIDE_ASSERT(_loaderThread == nullptr,
18 18 "GPUState::startLoaderThread error: double init detected!");
19 - _loaderThread.reset(new std::thread(loadingFunction));
19 +
20 + if (Config::USE_GPU_THREADED_LOADING) {
21 + _loaderThread.reset(new std::thread(loadingFunction));
22 + }
23 +
20 24 return true;
21 25 }
22 26
23 27 bool GPUState::stopLoaderThread() {
24 - DIVIDE_ASSERT(_loaderThread != nullptr,
25 - "GPUState::stopLoaderThread error: stop called without "
26 - "calling start first!");
27 - closeLoadingThread(true);
28 - {
29 - std::unique_lock<std::mutex> lk(_loadQueueMutex);
30 - _loadQueueDataReady = true;
31 - _loadQueueCV.notify_one();
28 + if (Config::USE_GPU_THREADED_LOADING) {
29 + DIVIDE_ASSERT(_loaderThread != nullptr,
30 + "GPUState::stopLoaderThread error: stop called without "
31 + "calling start first!");
32 + closeLoadingThread(true);
33 + {
34 + std::unique_lock<std::mutex> lk(_loadQueueMutex);
35 + _loadQueueDataReady = true;
36 + _loadQueueCV.notify_one();
37 + }
38 + while (loadingThreadAvailable()) {
39 + std::this_thread::sleep_for(std::chrono::milliseconds(10));
40 + }
41 + _loaderThread->join();
42 + _loaderThread.reset(nullptr);
32 43 }
33 - while (loadingThreadAvailable()) {
34 - std::this_thread::sleep_for(std::chrono::milliseconds(10));
35 - }
36 - _loaderThread->join();
37 - _loaderThread.reset(nullptr);
44 +
38 45 return true;
39 46 }
40 47