SpiecsEngine
 
Loading...
Searching...
No Matches

◆ Start() [1/2]

template<typename ... Params>
void Spices::ThreadPool_Basic< Params >::Start ( int initThreadSize = 0.5 * std::thread::hardware_concurrency())
inlineinherited

Start Run this thread pool.

Parameters
[in]initThreadSizeThread Size.

Definition at line 682 of file ThreadPoolBasic.h.

683 {
685
686 m_IsPoolRunning = true;
687 m_InitThreadSize = initThreadSize;
688 m_IdleThreadSize = initThreadSize;
689 m_NThreads = initThreadSize;
690
691 for (uint32_t i = 0; i < m_InitThreadSize; i++)
692 {
693 auto ptr = std::make_unique<Thread<>>(std::bind(&ThreadPool_Basic<>::ThreadFunc, this, std::placeholders::_1), i);
694 int threadId = ptr->GetId();
695
696 m_Threads.emplace(threadId, std::move(ptr));
697 m_Threads[threadId]->Start();
698 }
699 }
#define SPICES_PROFILE_ZONE
std::atomic_int m_IdleThreadSize
Idled thread size.
std::unordered_map< uint32_t, std::unique_ptr< Thread< Params... > > > m_Threads
Threads Container.
uint32_t m_InitThreadSize
Initialized thread size.
void ThreadFunc(Thread<> *thread)
Thread Function.
std::atomic_int m_NThreads
Threads Count.
std::atomic_bool m_IsPoolRunning
True if this thread pool is in use.

References Spices::ThreadPool_Basic< Params >::m_InitThreadSize.