SpiecsEngine
 
Loading...
Searching...
No Matches

◆ Start()

void Spices::VulkanCmdThreadPool::Start ( int initThreadSize = 0.5 * std::thread::hardware_concurrency())

Start Run this thread pool.

Parameters
[in]initThreadSizeThread Size.

Definition at line 50 of file VulkanCmdThreadPool.cpp.

51 {
53
54 m_IsPoolRunning = true;
55 m_InitThreadSize = initThreadSize;
56 m_IdleThreadSize = initThreadSize;
57 m_NThreads = initThreadSize;
58
59 for (uint32_t i = 0; i < m_InitThreadSize; i++)
60 {
61 auto ptr = std::make_unique<Thread<VkCommandBuffer>>(std::bind(&VulkanCmdThreadPool::ThreadFunc, this, std::placeholders::_1), i);
62 uint32_t threadId = ptr->GetId();
63
64 m_Threads.emplace(threadId, std::move(ptr));
65 m_Threads[threadId]->Start();
66 }
67 }
#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.
std::atomic_int m_NThreads
Threads Count.
std::atomic_bool m_IsPoolRunning
True if this thread pool is in use.
void ThreadFunc(Thread< VkCommandBuffer > *thread)
Thread Function.

Referenced by VulkanCmdThreadPool().