mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-13 20:11:35 -06:00
4.27 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
31e7b924e8
commit
d66cf2fcf3
79
7zip/Compress/Rar29/Original/system.cpp
Executable file
79
7zip/Compress/Rar29/Original/system.cpp
Executable file
@@ -0,0 +1,79 @@
|
||||
#include "rar.hpp"
|
||||
|
||||
#ifndef _WIN_CE
|
||||
static int SleepTime=0;
|
||||
|
||||
void InitSystemOptions(int SleepTime)
|
||||
{
|
||||
::SleepTime=SleepTime;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(SFX_MODULE) && !defined(_WIN_CE)
|
||||
|
||||
#if defined(_WIN_32) && !defined(BELOW_NORMAL_PRIORITY_CLASS)
|
||||
#define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
|
||||
#define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
|
||||
#endif
|
||||
|
||||
void SetPriority(int Priority)
|
||||
{
|
||||
#ifdef _WIN_32
|
||||
uint PriorityClass;
|
||||
int PriorityLevel;
|
||||
if (Priority<1 || Priority>15)
|
||||
return;
|
||||
|
||||
if (Priority==1)
|
||||
{
|
||||
PriorityClass=IDLE_PRIORITY_CLASS;
|
||||
PriorityLevel=THREAD_PRIORITY_IDLE;
|
||||
}
|
||||
else
|
||||
if (Priority<7)
|
||||
{
|
||||
PriorityClass=IDLE_PRIORITY_CLASS;
|
||||
PriorityLevel=Priority-4;
|
||||
}
|
||||
else
|
||||
if (Priority==7)
|
||||
{
|
||||
PriorityClass=BELOW_NORMAL_PRIORITY_CLASS;
|
||||
PriorityLevel=THREAD_PRIORITY_ABOVE_NORMAL;
|
||||
}
|
||||
else
|
||||
if (Priority<10)
|
||||
{
|
||||
PriorityClass=NORMAL_PRIORITY_CLASS;
|
||||
PriorityLevel=Priority-7;
|
||||
}
|
||||
else
|
||||
if (Priority==10)
|
||||
{
|
||||
PriorityClass=ABOVE_NORMAL_PRIORITY_CLASS;
|
||||
PriorityLevel=THREAD_PRIORITY_NORMAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
PriorityClass=HIGH_PRIORITY_CLASS;
|
||||
PriorityLevel=Priority-13;
|
||||
}
|
||||
SetPriorityClass(GetCurrentProcess(),PriorityClass);
|
||||
SetThreadPriority(GetCurrentThread(),PriorityLevel);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void Wait()
|
||||
{
|
||||
#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE)
|
||||
if (SleepTime!=0)
|
||||
Sleep(SleepTime);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user