<commit_before>#include <utility>
#include <thread>

#include <thread>
#include <chrono>

template<class C,typename ... Args>
void thread_method(C* obj,void(C::*func)(Args& ...),Args& ... args)
{
    (obj->*func)(std::forward<Args>(args)...);
};

template <class T>
template <typename ... Args>
GeneticEngine<T>::GeneticEngine(int nb_threads,float taux_mut,int tranche_mut,std::string filename,int pop_size,Args& ... args) : size(nb_threads)
{
    islands = new  GeneticThread(taux_mut,tranche_mut,filename,pop_size/nb_threads,std::forward<Args>(args)...)[size];

};

template <class T>
template <typename ... Args>
T* GeneticEngine<T>::run(const int nb_generation,const int size_enf,Args& ... args);
{
    for(int i=0;i<size;++i)
        islands[i].thread= std::thread(thread_method<GeneticThread>,&islands[i],&GeneticThread::run);
    Wait();
};

template<class T>
{
    bool end=false;
    while(not end)
    { 
        end = false;
        for(int i=0;i<size and not end ;++i)
            end = islands[i].thread.joinable();

        if (end)
            break;
         std::this_thread::sleep_for(std::chrono::std::chrono::milliseconds(100));
    }
}<commit_msg>add waiting for end<commit_after>#include <utility>
#include <thread>

#include <thread>
#include <chrono>

template<class C,typename ... Args>
void thread_method(C* obj,void(C::*func)(Args& ...),Args& ... args)
{
    (obj->*func)(std::forward<Args>(args)...);
};

template <class T>
template <typename ... Args>
GeneticEngine<T>::GeneticEngine(int nb_threads,float taux_mut,int tranche_mut,std::string filename,int pop_size,Args& ... args) : size(nb_threads)
{
    islands = new  GeneticThread(taux_mut,tranche_mut,filename,pop_size/nb_threads,std::forward<Args>(args)...)[size];

};

template <class T>
template <typename ... Args>
T* GeneticEngine<T>::run(const int nb_generation,const int size_enf,Args& ... args);
{
    for(int i=0;i<size;++i)
        islands[i].thread= std::thread(thread_method<GeneticThread>,&islands[i],&GeneticThread::run);
    Wait();
};

template<class T>
void GeneticEngine<T>::Wait()
{
    bool end=false;
    while(not end)
    { 
        end = false;
        for(int i=0;i<size and not end ;++i)
            end = islands[i].thread.joinable();

        if (end)
            break;
         std::this_thread::sleep_for(std::chrono::std::chrono::milliseconds(100));
    }
}
{'fraction_non_alphanumeric': 0.1821247892074199, 'fraction_numerical': 0.0042158516020236085, 'mean_word_length': 4.114224137931035, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3586526', 'n_tokens_mistral': 848, 'n_tokens_neox': 839, 'n_words': 149}