LCOV - code coverage report
Current view: top level - src/Tools/Thread/Thread_pool - Thread_pool.cpp (source / functions) Hit Total Coverage
Test: streampu_clean.info Lines: 14 28 50.0 %
Date: 2025-01-11 12:25:42 Functions: 5 10 50.0 %

          Line data    Source code
       1             : #include <iostream>
       2             : 
       3             : #include "Tools/Exception/exception.hpp"
       4             : #include "Tools/Thread/Thread_pool/Thread_pool.hpp"
       5             : 
       6             : using namespace spu;
       7             : using namespace spu::tools;
       8             : 
       9         592 : Thread_pool::Thread_pool(const size_t n_threads)
      10         592 :   : n_threads(n_threads)
      11         592 :   , initialized(false)
      12        3916 :   , func_init([](const size_t) {})
      13         592 :   , func_deinit([](const size_t) {})
      14         592 :   , func_exec([](const size_t) { throw tools::unimplemented_error(__FILE__, __LINE__, __func__); })
      15         592 :   , stop_threads(false)
      16             : {
      17         592 : }
      18             : 
      19           0 : Thread_pool::Thread_pool(const Thread_pool& other)
      20           0 :   : n_threads(other.n_threads)
      21           0 :   , initialized(false)
      22           0 :   , func_init(other.func_init)
      23           0 :   , func_deinit(other.func_deinit)
      24           0 :   , func_exec(other.func_deinit)
      25           0 :   , stop_threads(other.stop_threads)
      26             : {
      27           0 : }
      28             : 
      29             : void
      30           0 : Thread_pool::set_func_init(std::function<void(const size_t)>& func_init)
      31             : {
      32           0 :     this->func_init = func_init;
      33           0 : }
      34             : 
      35             : void
      36           0 : Thread_pool::set_func_deinit(std::function<void(const size_t)>& func_deinit)
      37             : {
      38           0 :     this->func_deinit = func_deinit;
      39           0 : }
      40             : 
      41             : void
      42         443 : Thread_pool::set_func_exec(std::function<void(const size_t)>& func_exec)
      43             : {
      44         443 :     this->func_exec = func_exec;
      45         443 : }
      46             : 
      47             : void
      48         440 : Thread_pool::unset_func_exec()
      49             : {
      50         440 :     this->func_exec = [](const size_t) { throw tools::unimplemented_error(__FILE__, __LINE__, __func__); };
      51         436 : }

Generated by: LCOV version 1.14