- VBOX: Add the ability for the wrapper to know if vboxmanage has hung or is stuck

in a loop.  If so, terminate the process and return an error to the calling
      function.
      
    samples/vboxwrapper/
        vbox.cpp

svn path=/trunk/boinc/; revision=24767
This commit is contained in:
Rom Walton 2011-12-09 16:30:13 +00:00
parent 4e54344742
commit a635b075ef
2 changed files with 23 additions and 1 deletions

View File

@ -8919,3 +8919,11 @@ Rom 9 Dec 2011
samples/vboxwrapper/
vbox.cpp
Rom 9 Dec 2011
- VBOX: Add the ability for the wrapper to know if vboxmanage has hung or is stuck
in a loop. If so, terminate the process and return an error to the calling
function.
samples/vboxwrapper/
vbox.cpp

View File

@ -116,6 +116,7 @@ int VBOX_VM::vbm_popen(string& arguments, string& output, const char* item) {
void* pBuf = NULL;
DWORD dwCount = 0;
unsigned long ulExitCode = 0;
unsigned long ulExitTimeout = 0;
memset(&si, 0, sizeof(si));
memset(&pi, 0, sizeof(pi));
@ -178,7 +179,20 @@ int VBOX_VM::vbm_popen(string& arguments, string& output, const char* item) {
}
if (ulExitCode != STILL_ACTIVE) break;
Sleep(100);
// Timeout?
if (ulExitTimeout >= 60000) {
fprintf(
stderr,
"%s Process Timeout!.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
TerminateProcess(pi.hProcess, EXIT_FAILURE);
}
Sleep(250);
ulExitTimeout += 250;
}
CLEANUP: