MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / SetPriority

Function SetPriority

Libraries/unrar/system.cpp:12–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11#if !defined(SFX_MODULE)
12void SetPriority(int Priority)
13{
14#ifdef _WIN_ALL
15 uint PriorityClass;
16 int PriorityLevel;
17 if (Priority<1 || Priority>15)
18 return;
19
20 if (Priority==1)
21 {
22 PriorityClass=IDLE_PRIORITY_CLASS;
23 PriorityLevel=THREAD_PRIORITY_IDLE;
24
25// Background mode for Vista, can be slow for many small files.
26// if (WinNT()>=WNT_VISTA)
27// SetPriorityClass(GetCurrentProcess(),PROCESS_MODE_BACKGROUND_BEGIN);
28 }
29 else
30 if (Priority<7)
31 {
32 PriorityClass=IDLE_PRIORITY_CLASS;
33 PriorityLevel=Priority-4;
34 }
35 else
36 if (Priority==7)
37 {
38 PriorityClass=BELOW_NORMAL_PRIORITY_CLASS;
39 PriorityLevel=THREAD_PRIORITY_ABOVE_NORMAL;
40 }
41 else
42 if (Priority<10)
43 {
44 PriorityClass=NORMAL_PRIORITY_CLASS;
45 PriorityLevel=Priority-7;
46 }
47 else
48 if (Priority==10)
49 {
50 PriorityClass=ABOVE_NORMAL_PRIORITY_CLASS;
51 PriorityLevel=THREAD_PRIORITY_NORMAL;
52 }
53 else
54 {
55 PriorityClass=HIGH_PRIORITY_CLASS;
56 PriorityLevel=Priority-13;
57 }
58 SetPriorityClass(GetCurrentProcess(),PriorityClass);
59 SetThreadPriority(GetCurrentThread(),PriorityLevel);
60
61#ifdef RAR_SMP
62 ThreadPool::SetPriority(PriorityLevel);
63#endif
64
65#endif
66}
67#endif
68
69

Callers 1

ProcessSwitchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected