blob: cc5825aa0f8756c50d8acd5fa0cee51b5c564da3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#ifndef PREVENTSTANDBY_H_INCLUDED
#define PREVENTSTANDBY_H_INCLUDED
#ifdef FFS_WIN
#include "win.h" //includes "windows.h"
#endif
namespace zen
{
struct DisableStandby //signal a "busy" state to the operating system
{
#ifdef FFS_WIN
DisableStandby() { ::SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED /* | ES_AWAYMODE_REQUIRED*/ ); }
~DisableStandby() { ::SetThreadExecutionState(ES_CONTINUOUS); }
#endif
};
#ifndef PROCESS_MODE_BACKGROUND_BEGIN
#define PROCESS_MODE_BACKGROUND_BEGIN 0x00100000 // Windows Server 2003 and Windows XP/2000: This value is not supported!
#define PROCESS_MODE_BACKGROUND_END 0x00200000 //
#endif
struct ScheduleForBackgroundProcessing //lower CPU and file I/O priorities
{
#ifdef FFS_WIN
ScheduleForBackgroundProcessing() { ::SetPriorityClass(::GetCurrentProcess(), PROCESS_MODE_BACKGROUND_BEGIN); }
~ScheduleForBackgroundProcessing() { ::SetPriorityClass(::GetCurrentProcess(), PROCESS_MODE_BACKGROUND_END); }
#endif
};
}
#endif // PREVENTSTANDBY_H_INCLUDED
|