Bug 418960, Download scanner threads should be lower priority r=sdwilsh

This commit is contained in:
tellrob%gmail.com 2008-02-23 22:14:56 +00:00
Родитель 72d212dcb7
Коммит f936fe606d
1 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -259,12 +259,24 @@ nsDownloadScanner::ListCLSID()
return 0;
}
#ifndef THREAD_MODE_BACKGROUND_BEGIN
#define THREAD_MODE_BACKGROUND_BEGIN 0x00010000
#endif
#ifndef THREAD_MODE_BACKGROUND_END
#define THREAD_MODE_BACKGROUND_END 0x00020000
#endif
unsigned int __stdcall
nsDownloadScanner::ScannerThreadFunction(void *p)
{
HANDLE currentThread = GetCurrentThread();
NS_ASSERTION(!NS_IsMainThread(), "Antivirus scan should not be run on the main thread");
nsDownloadScanner::Scan *scan = static_cast<nsDownloadScanner::Scan*>(p);
if (!SetThreadPriority(currentThread, THREAD_MODE_BACKGROUND_BEGIN))
(void)SetThreadPriority(currentThread, THREAD_PRIORITY_IDLE);
scan->DoScan();
(void)SetThreadPriority(currentThread, THREAD_MODE_BACKGROUND_END);
_endthreadex(0);
return 0;
}