Let Downloadmanager use new thread methods

This commit is contained in:
Alexander Bock
2016-06-22 08:27:24 +02:00
parent 3775bbe6b1
commit 342ed2f161

View File

@@ -348,8 +348,11 @@ void DownloadManager::downloadRequestFilesAsync(const std::string& identifier,
};
if (_useMultithreadedDownload) {
using namespace ghoul::thread;
std::thread t = std::thread(downloadFunction);
ghoul::thread::setPriority(t, ghoul::thread::ThreadPriority::Lowest);
ghoul::thread::setPriority(
t, ThreadPriorityClass::Idle, ThreadPriorityLevel::Lowest
);
t.detach();
}
else
@@ -384,16 +387,11 @@ void DownloadManager::getFileExtension(const std::string& url,
}
};
if (_useMultithreadedDownload) {
using namespace ghoul::thread;
std::thread t = std::thread(requestFunction);
#ifdef WIN32
std::thread::native_handle_type h = t.native_handle();
SetPriorityClass(h, IDLE_PRIORITY_CLASS);
SetThreadPriority(h, THREAD_PRIORITY_LOWEST);
#else
// TODO: Implement thread priority ---abock
#endif
ghoul::thread::setPriority(
t, ThreadPriorityClass::Idle, ThreadPriorityLevel::Lowest
);
t.detach();
}
else {