From d69966527457e4ff47f3f09e9b6c8261fc4c908e Mon Sep 17 00:00:00 2001 From: Snaipe Date: Sat, 23 Apr 2016 12:09:14 +0200 Subject: [PATCH] windows: Fixed hangs --- src/compat/process.c | 7 ++++--- src/core/runner.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/compat/process.c b/src/compat/process.c index 48926e3..34424bd 100644 --- a/src/compat/process.c +++ b/src/compat/process.c @@ -134,9 +134,10 @@ static int get_win_status(HANDLE handle) { #endif struct worker_context g_worker_context = {.test = NULL}; -unsigned long long g_ppid = 0; #ifdef VANILLA_WIN32 +unsigned long long g_ppid = 0; + struct full_context { struct criterion_test test; struct criterion_test_extra_data test_data; @@ -209,8 +210,6 @@ static void *chld_pump_thread_main(void *nil) { void init_proc_compat(void) { #ifndef VANILLA_WIN32 - g_ppid = get_process_id(); - child_pump_running = true; int err = pthread_create(&child_pump, NULL, chld_pump_thread_main, NULL); if (err) { @@ -218,6 +217,8 @@ void init_proc_compat(void) { exit(1); } #else + g_ppid = get_process_id(); + InitializeConditionVariable(&wait_cond); InitializeCriticalSection(&wait_sync); wait_threads = 0; diff --git a/src/core/runner.c b/src/core/runner.c index 5da72ab..0bf5877 100644 --- a/src/core/runner.c +++ b/src/core/runner.c @@ -386,6 +386,8 @@ static int criterion_run_all_tests_impl(struct criterion_test_set *set) { abort(); } + init_proc_compat(); + g_client_socket = connect_client(); if (g_client_socket < 0) { criterion_perror("Could not initialize the message client: %s.\n", @@ -393,8 +395,6 @@ static int criterion_run_all_tests_impl(struct criterion_test_set *set) { abort(); } - init_proc_compat(); - struct criterion_global_stats *stats = stats_init(); run_tests_async(set, stats, sock);