Handle safely winfork failures
This commit is contained in:
parent
1d908327d8
commit
c5e6d0c770
2 changed files with 12 additions and 2 deletions
|
@ -290,7 +290,17 @@ s_proc_handle *fork_process() {
|
|||
ResumeThread(info.hThread);
|
||||
CloseHandle(info.hThread);
|
||||
|
||||
while (!ctx->resumed); // wait until the child has initialized itself
|
||||
// wait until the child has initialized itself
|
||||
while (!ctx->resumed) {
|
||||
DWORD exit;
|
||||
GetExitCodeProcess(info.hProcess, &exit);
|
||||
if (exit != STILL_ACTIVE) {
|
||||
UnmapViewOfFile(ctx);
|
||||
CloseHandle(sharedMem);
|
||||
CloseHandle(info.hProcess);
|
||||
return (void *) -1;
|
||||
}
|
||||
}
|
||||
|
||||
UnmapViewOfFile(ctx);
|
||||
CloseHandle(sharedMem);
|
||||
|
|
|
@ -91,7 +91,7 @@ struct process *spawn_test_worker(struct criterion_test *test,
|
|||
|
||||
s_proc_handle *proc = fork_process();
|
||||
if (proc == (void *) -1) {
|
||||
return NULL;
|
||||
abort();
|
||||
} else if (proc == NULL) {
|
||||
run_worker(&g_worker_context);
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Reference in a new issue