[x265] [PATCH] cli: prevent Windows from falling into standby

Xinyue Lu maillist at 7086.in
Mon Mar 30 13:47:49 CEST 2015


It will set the execution state flags on start and clear the flags on exit.

# HG changeset patch
# User Xinyue Lu <i at 7086.in>
# Date 1427715767 25200
#      Mon Mar 30 04:42:47 2015 -0700
# Branch Yuuki
# Node ID 3581791c9128bb47bab1b98e04cdc0061896fc03
# Parent  7c31ea0490e2700a3d32a618a3e6d5e81807eb3f
cli: prevent Windows from falling into standby

diff -r 7c31ea0490e2 -r 3581791c9128 source/x265.cpp
--- a/source/x265.cpp Mon Mar 30 04:12:50 2015 -0700
+++ b/source/x265.cpp Mon Mar 30 04:42:47 2015 -0700
@@ -54,6 +54,7 @@
 #else
 #define GetConsoleTitle(t, n)
 #define SetConsoleTitle(t)
+#define SetThreadExecutionState(es)
 #endif

 using namespace x265;
@@ -467,6 +468,7 @@
     THREAD_NAME("API", 0);

     GetConsoleTitle(orgConsoleTitle, CONSOLE_TITLE_SIZE);
+    SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED |
ES_AWAYMODE_REQUIRED);

     x265_param *param = x265_param_alloc();
     CLIOptions cliopt;
@@ -640,6 +642,7 @@
     X265_FREE(errorBuf);

     SetConsoleTitle(orgConsoleTitle);
+    SetThreadExecutionState(ES_CONTINUOUS);

 #if HAVE_VLD
     assert(VLDReportLeaks() == 0);


More information about the x265-devel mailing list