2016-03-29 03:03:54 +02:00
|
|
|
|
|
|
|
#ifndef SE_INCL_PRIORITY_INL
|
|
|
|
#define SE_INCL_PRIORITY_INL
|
|
|
|
#ifdef PRAGMA_ONCE
|
|
|
|
#pragma once
|
|
|
|
#endif
|
|
|
|
|
2016-03-11 14:57:17 +01:00
|
|
|
class CSetPriority {
|
|
|
|
public:
|
2016-03-29 03:03:54 +02:00
|
|
|
#ifdef PLATFORM_WIN32
|
2016-03-11 14:57:17 +01:00
|
|
|
DWORD sp_dwProcessOld;
|
|
|
|
int sp_iThreadOld;
|
|
|
|
HANDLE sp_hThread;
|
|
|
|
HANDLE sp_hProcess;
|
|
|
|
CSetPriority(DWORD dwProcess, int iThread)
|
|
|
|
{
|
|
|
|
sp_hProcess = GetCurrentProcess();
|
|
|
|
sp_hThread = GetCurrentThread();
|
|
|
|
|
|
|
|
sp_dwProcessOld = GetPriorityClass(sp_hProcess);
|
|
|
|
sp_iThreadOld = GetThreadPriority(sp_hThread);
|
|
|
|
BOOL bSuccessProcess = SetPriorityClass(sp_hProcess, dwProcess);
|
|
|
|
BOOL bSuccessThread = SetThreadPriority(sp_hThread, iThread);
|
|
|
|
ASSERT(bSuccessProcess && bSuccessThread);
|
|
|
|
}
|
|
|
|
~CSetPriority(void)
|
|
|
|
{
|
|
|
|
BOOL bSuccessProcess = SetPriorityClass(sp_hProcess, sp_dwProcessOld);
|
|
|
|
BOOL bSuccessThread = SetThreadPriority(sp_hThread, sp_iThreadOld);
|
|
|
|
ASSERT(bSuccessProcess && bSuccessThread);
|
|
|
|
}
|
2016-03-29 03:03:54 +02:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
CSetPriority(DWORD dwProcess, int iThread) { STUBBED(""); }
|
|
|
|
~CSetPriority(void) { STUBBED(""); }
|
|
|
|
|
|
|
|
#endif
|
2016-03-11 14:57:17 +01:00
|
|
|
};
|
2016-03-29 03:03:54 +02:00
|
|
|
|
|
|
|
#endif /* include-once blocker. */
|
|
|
|
|