thread
Brett 2024-07-19 22:54:32 -04:00
parent 8e5a3f3b7c
commit 5d72923998
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
project(blt-gp VERSION 0.0.89) project(blt-gp VERSION 0.0.90)
include(CTest) include(CTest)

View File

@ -501,13 +501,18 @@ namespace blt::gp
thread_execution_service = nullptr; thread_execution_service = nullptr;
delete cpy; delete cpy;
} }
void kill()
{
thread_helper.lifetime_over = true;
}
private: private:
type_provider& system; type_provider& system;
operator_storage storage; operator_storage storage;
population_t current_pop; population_t current_pop;
population_stats current_stats {}; population_stats current_stats{};
population_t next_pop; population_t next_pop;
std::atomic_uint64_t current_generation = 0; std::atomic_uint64_t current_generation = 0;
@ -519,7 +524,7 @@ namespace blt::gp
std::vector<std::unique_ptr<std::thread>> threads; std::vector<std::unique_ptr<std::thread>> threads;
std::mutex thread_function_control; std::mutex thread_function_control;
std::condition_variable thread_function_condition {}; std::condition_variable thread_function_condition{};
std::atomic_uint64_t evaluation_left = 0; std::atomic_uint64_t evaluation_left = 0;