threadpool.hpp
/**
        *   If *max_threads* is not specified,
        *   the pool size is set to the max number
        *   of threads supported by the architecture.
        *   At least one thread is created.
        */
If *max_threads* is not specified,
the pool size is set to the max number
of threads supported by the architecture.
At least one thread is created.
If * max_threads * is not specified the pool size is set to the max number of threads supported by the architecture . At least one thread is created .
ThreadPool(int max_threads = std::thread::hardware_concurrency()) 
        noexcept(false) : 
            _sem_api(Semaphore(1)),
            _sem_job_ins_container(Semaphore(1)),
            _thread_sleep_time_ns(1000),
            _run_pool_thread(true),
            _threads_count(0),
            _thread_to_kill_c(0),
            _push_c(0),
            _prev_threads(0)
        {
            #if TP_ENABLE_DEFAULT_EXCEPTION_CALL
            _exception_action = [](std::exception_ptr e) {};
            #endif
            #if TP_ENABLE_SANITY_CHECKS
            try {
                resize(max_threads);
            } catch(std::runtime_error e) {
                throw e;
            }
            #else
                resize(max_threads);
            #endif
        }
ThreadPool ( int max_threads = std :: thread :: hardware_concurrency ( ) ) noexcept ( false ) : _sem_api ( Semaphore ( 1 ) ) , _sem_job_ins_container ( Semaphore ( 1 ) ) , _thread_sleep_time_ns ( 1000 ) , _run_pool_thread ( true ) , _threads_count ( 0 ) , _thread_to_kill_c ( 0 ) , _push_c ( 0 ) , _prev_threads ( 0 ) { #if TP_ENABLE_DEFAULT_EXCEPTION_CALL _exception_action = [ ] ( std :: exception_ptr e ) { } ; #endif #if TP_ENABLE_SANITY_CHECKS try { resize ( max_threads ) ; } catch ( std :: runtime_error e ) { throw e ; } #else resize ( max_threads ) ; #endif }
If *max_threads* is not specified,
   the pool size is set to the max number
   of threads supported by the architecture.
If * max_threads * is not specified the pool size is set to the max number of threads supported by the architecture .