summaryrefslogtreecommitdiff
path: root/zen/process_status.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:15:39 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:15:39 +0200
commitd2854834e18443876c8f75e0a7f3b88d1d549fc4 (patch)
treee967b628081e50abc7c34cd264e6586271c7e728 /zen/process_status.h
parent4.1 (diff)
downloadFreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.tar.gz
FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.tar.bz2
FreeFileSync-d2854834e18443876c8f75e0a7f3b88d1d549fc4.zip
4.2
Diffstat (limited to 'zen/process_status.h')
-rw-r--r--zen/process_status.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/zen/process_status.h b/zen/process_status.h
new file mode 100644
index 00000000..cc5825aa
--- /dev/null
+++ b/zen/process_status.h
@@ -0,0 +1,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
bgstack15