12 #ifndef vtkSMPThreadPool_h
13 #define vtkSMPThreadPool_h
15 #include "vtkCommonCoreModule.h"
30 VTK_ABI_NAMESPACE_BEGIN
45 struct ProxyThreadData;
59 class VTKCOMMONCORE_EXPORT
Proxy final
89 std::vector<std::reference_wrapper<std::thread>> GetThreads()
const;
94 bool IsTopLevel()
const noexcept;
101 std::unique_ptr<ProxyData> Data;
125 Proxy AllocateThreads(std::size_t threadCount = 0);
130 static constexpr std::size_t ExternalThreadID = 1;
139 std::size_t GetThreadId() const noexcept;
144 bool IsParallelScope() const noexcept;
149 bool GetSingleThread() const;
154 std::
size_t ThreadCount() const noexcept;
158 static
void RunJob(ThreadData&
data,
std::
size_t jobIndex,
std::unique_lock<
std::mutex>& lock);
160 ThreadData* GetCallerThreadData() const noexcept;
162 std::thread MakeThread();
163 void FillThreadsForNestedProxy(ProxyData* proxy,
std::
size_t maxCount);
164 std::
size_t GetNextThreadId() noexcept;
166 std::atomic<
bool> Initialized{};
167 std::atomic<bool> Joining{};
168 std::vector<std::unique_ptr<ThreadData>> Threads;
169 std::atomic<std::size_t> NextProxyThreadId{ 1 };
172 static vtkSMPThreadPool& GetInstance();
175 VTK_ABI_NAMESPACE_END
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
Proxy class used to submit work to the thread pool.
Internal thread pool implementation used in SMP functions.