mirror of https://github.com/BOINC/boinc.git
LIB: Simplify logic for get_exit_status(). Put caller to sleep until process exits, then check for it's exit status.
This commit is contained in:
parent
88135a7000
commit
9d726ba0fc
12
lib/util.cpp
12
lib/util.cpp
|
@ -472,15 +472,8 @@ void kill_program(int pid) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
int get_exit_status(HANDLE pid_handle) {
|
int get_exit_status(HANDLE pid_handle) {
|
||||||
unsigned long status=1;
|
unsigned long status=1;
|
||||||
while (1) {
|
WaitForSingleObject(pid_handle, INFINITE);
|
||||||
if (GetExitCodeProcess(pid_handle, &status)) {
|
GetExitCodeProcess(pid_handle, &status);
|
||||||
if (status == STILL_ACTIVE) {
|
|
||||||
boinc_sleep(1);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (int) status;
|
return (int) status;
|
||||||
}
|
}
|
||||||
bool process_exists(HANDLE h) {
|
bool process_exists(HANDLE h) {
|
||||||
|
@ -490,7 +483,6 @@ bool process_exists(HANDLE h) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
int get_exit_status(int pid) {
|
int get_exit_status(int pid) {
|
||||||
int status;
|
int status;
|
||||||
|
|
Loading…
Reference in New Issue