LCOV - code coverage report
Current view: top level - include/Tools/Thread/Thread_pool - Thread_pool.hpp (source / functions) Hit Total Coverage
Test: streampu_clean.info Lines: 1 1 100.0 %
Date: 2025-01-11 12:25:42 Functions: 1 2 50.0 %

          Line data    Source code
       1             : #ifndef THREAD_POOL_HPP_
       2             : #define THREAD_POOL_HPP_
       3             : 
       4             : #include <cstdint>
       5             : #include <functional>
       6             : 
       7             : #include <vector>
       8             : 
       9             : namespace spu
      10             : {
      11             : namespace tools
      12             : {
      13             : 
      14             : class Thread_pool
      15             : {
      16             :   protected:
      17             :     const size_t n_threads;
      18             :     bool initialized;
      19             :     std::function<void(const size_t)> func_init;
      20             :     std::function<void(const size_t)> func_deinit;
      21             :     std::function<void(const size_t)> func_exec;
      22             :     bool stop_threads;
      23             : 
      24             :   public:
      25             :     Thread_pool(const size_t n_threads);
      26             :     Thread_pool(const Thread_pool& other);
      27         592 :     virtual ~Thread_pool() = default;
      28             :     void set_func_init(std::function<void(const size_t)>& func_init);
      29             :     void set_func_deinit(std::function<void(const size_t)>& func_deinit);
      30             :     void set_func_exec(std::function<void(const size_t)>& func_exec);
      31             :     void unset_func_exec();
      32             :     virtual void run(const bool async = false) = 0;
      33             :     virtual void run(std::function<void(const size_t)>& func_exec, const bool async = false) = 0;
      34             :     virtual void wait() = 0;
      35             :     virtual void init(const bool async = false) = 0;
      36             : };
      37             : 
      38             : }
      39             : }
      40             : 
      41             : #endif /* THREAD_POOL_HPP_ */

Generated by: LCOV version 1.14