From c110cccc1848a18125bcea22145feba6ffb3f2aa Mon Sep 17 00:00:00 2001 From: Marco van Wieringen Date: Thu, 18 Jul 2013 11:15:55 +0200 Subject: [PATCH] MINGW now supports SetThreadExecutionState The MINGW version we compile with in OBS supports SetThreadExecutionState so lets use it. --- src/filed/dir_cmd.c | 8 ++++++++ src/win32/compat/compat.c | 5 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/filed/dir_cmd.c b/src/filed/dir_cmd.c index 5097a903858..cf43663c5ea 100644 --- a/src/filed/dir_cmd.c +++ b/src/filed/dir_cmd.c @@ -422,6 +422,10 @@ static void *handle_director_connection(BSOCK *dir) const char jobname[12] = "*Director*"; // saveCWD save_cwd; +#ifdef HAVE_WIN32 + prevent_os_suspensions(); +#endif + jcr = new_jcr(sizeof(JCR), filed_free_jcr); /* create JCR */ jcr->dir_bsock = dir; jcr->ff = init_find_files(); @@ -541,6 +545,10 @@ static void *handle_director_connection(BSOCK *dir) Dsm_check(100); garbage_collect_memory_pool(); +#ifdef HAVE_WIN32 + allow_os_suspensions(); +#endif + return NULL; } diff --git a/src/win32/compat/compat.c b/src/win32/compat/compat.c index f3444ba8c2a..7b1b70778d4 100644 --- a/src/win32/compat/compat.c +++ b/src/win32/compat/compat.c @@ -2755,11 +2755,10 @@ void LogErrorMsg(const char *message) */ void prevent_os_suspensions() { - /* not in mingw */ -// SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); + SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); } void allow_os_suspensions() { -// SetThreadExecutionState(ES_CONTINUOUS); + SetThreadExecutionState(ES_CONTINUOUS); }