Skip to content

Commit

Permalink
MINGW now supports SetThreadExecutionState
Browse files Browse the repository at this point in the history
The MINGW version we compile with in OBS supports
SetThreadExecutionState so lets use it.
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent 2b47741 commit c110ccc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/filed/dir_cmd.c
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
}

Expand Down
5 changes: 2 additions & 3 deletions src/win32/compat/compat.c
Expand Up @@ -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);
}

0 comments on commit c110ccc

Please sign in to comment.