Fixed windows async worker termination reporting

This commit is contained in:
Snaipe 2015-09-17 06:30:04 -07:00
parent e011939d5e
commit ab9763c8cf
3 changed files with 10 additions and 8 deletions

View file

@ -24,9 +24,7 @@
#ifndef INTERNAL_H_
# define INTERNAL_H_
# include "posix.h"
# ifdef VANILLA_WIN32
# if defined(_WIN32) && !defined(__CYGWIN__)
# define VC_EXTRALEAN
# define WIN32_LEAN_AND_MEAN
# undef _WIN32_WINNT
@ -44,4 +42,6 @@
# include <sys/fcntl.h>
# endif
# include "posix.h"
#endif /* !INTERNAL_H_ */

View file

@ -140,8 +140,8 @@ struct wait_context {
HANDLE proc_handle;
};
static void handle_child_terminated(PVOID lpParameter,
BOOLEAN TimerOrWaitFired) {
static void CALLBACK handle_child_terminated(PVOID lpParameter,
BOOLEAN TimerOrWaitFired) {
assert(!TimerOrWaitFired);
@ -157,7 +157,8 @@ static void handle_child_terminated(PVOID lpParameter,
memcpy(buf, &kind, sizeof (kind));
memcpy(buf + sizeof (kind), &ws, sizeof (ws));
WriteFile(g_worker_pipe->fhs[1], buf, sizeof (buf), NULL, NULL);
DWORD written;
WriteFile(g_worker_pipe->fhs[1], buf, sizeof (buf), &written, NULL);
HANDLE whandle = wctx->wait_handle;
free(lpParameter);
@ -277,7 +278,9 @@ s_proc_handle *fork_process() {
CloseHandle(sharedMem);
struct wait_context *wctx = malloc(sizeof (struct wait_context));
*wctx = {}
*wctx = (struct wait_context) {
.proc_handle = info.hProcess,
};
RegisterWaitForSingleObject(
&wctx->wait_handle,

View file

@ -25,7 +25,6 @@
# define COMPAT_PROCESS_H_
# include "criterion/types.h"
# include "compat/posix.h"
# include "internal.h"
struct proc_handle {