From 5d72923998fd59cf76a7e777642a9c34e76bfb3d Mon Sep 17 00:00:00 2001 From: Brett Date: Fri, 19 Jul 2024 22:54:32 -0400 Subject: [PATCH] add kill --- CMakeLists.txt | 2 +- include/blt/gp/program.h | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a82f75c..57b8949 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(blt-gp VERSION 0.0.89) +project(blt-gp VERSION 0.0.90) include(CTest) diff --git a/include/blt/gp/program.h b/include/blt/gp/program.h index 6bbdeaf..f642373 100644 --- a/include/blt/gp/program.h +++ b/include/blt/gp/program.h @@ -501,13 +501,18 @@ namespace blt::gp thread_execution_service = nullptr; delete cpy; } + + void kill() + { + thread_helper.lifetime_over = true; + } private: type_provider& system; operator_storage storage; population_t current_pop; - population_stats current_stats {}; + population_stats current_stats{}; population_t next_pop; std::atomic_uint64_t current_generation = 0; @@ -519,7 +524,7 @@ namespace blt::gp std::vector> threads; std::mutex thread_function_control; - std::condition_variable thread_function_condition {}; + std::condition_variable thread_function_condition{}; std::atomic_uint64_t evaluation_left = 0;