diff --git a/src/compat/process.c b/src/compat/process.c index 24d09b7..27d1170 100644 --- a/src/compat/process.c +++ b/src/compat/process.c @@ -153,8 +153,6 @@ static pthread_t child_pump; static bool child_pump_running; static void *chld_pump_thread_main(void *nil) { - child_pump_running = true; - do { handle_sigchld_pump(); usleep(1000); @@ -166,11 +164,8 @@ static void *chld_pump_thread_main(void *nil) { void init_proc_compat(void) { #ifndef VANILLA_WIN32 - pthread_attr_t attr; - int err = pthread_attr_init(&attr) - || pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) - || pthread_create(&child_pump, &attr, chld_pump_thread_main, NULL) - || pthread_attr_destroy(&attr); + child_pump_running = true; + int err = pthread_create(&child_pump, NULL, chld_pump_thread_main, NULL); if (err) { perror(0); exit(1); @@ -181,6 +176,7 @@ void init_proc_compat(void) { void free_proc_compat(void) { #ifndef VANILLA_WIN32 child_pump_running = false; + pthread_join(child_pump, NULL); #endif } diff --git a/src/core/runner.c b/src/core/runner.c index 58f245f..70dbcad 100644 --- a/src/core/runner.c +++ b/src/core/runner.c @@ -411,7 +411,10 @@ static int criterion_run_all_tests_impl(struct criterion_test_set *set) { cleanup: free_proc_compat(); - nn_close(sock); + if (is_runner()) { + close_socket (g_client_socket); + close_socket (sock); + } sfree(stats); return result; }