mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-27 04:35:52 +01:00
25 lines
761 B
Plaintext
25 lines
761 B
Plaintext
|
class CSetPriority {
|
||
|
public:
|
||
|
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);
|
||
|
}
|
||
|
};
|