Internal thread pool implementation used in SMP functions.
More...
#include <vtkSMPThreadPool.h>
|
static constexpr std::size_t | ExternalThreadID = 1 |
| Value returned by GetThreadID when called by a thread that does not belong to the pool.
|
|
Internal thread pool implementation used in SMP functions.
This class is designed to be a Singleton thread pool, but local pool can be allocated too. This thread pool use a Proxy system that is used to allocate a certain amount of threads from the pool, which enable support for SMP local scopes. You need to have a Proxy to submit job to the pool.
Definition at line 40 of file vtkSMPThreadPool.h.
◆ vtkSMPThreadPool() [1/2]
vtk::detail::smp::vtkSMPThreadPool::vtkSMPThreadPool |
( |
| ) |
|
◆ ~vtkSMPThreadPool()
vtk::detail::smp::vtkSMPThreadPool::~vtkSMPThreadPool |
( |
| ) |
|
◆ vtkSMPThreadPool() [2/2]
vtk::detail::smp::vtkSMPThreadPool::vtkSMPThreadPool |
( |
const vtkSMPThreadPool & |
| ) |
|
|
delete |
◆ operator=()
◆ AllocateThreads()
Proxy vtk::detail::smp::vtkSMPThreadPool::AllocateThreads |
( |
std::size_t |
threadCount = 0 | ) |
|
Create a proxy.
Create a proxy that will use at most threadCount thread of the thread pool. Proxy act as a thread pool on its own, but will in practice submit its work to this pool, this prevent threads to be created every time a SMP function is called.
If the current thread not in the pool, it will create a "top-level" proxy, otherwise it will create a nested proxy. A nested proxy will never use a thread that is already in use by its "parent" proxies to prevent deadlocks. It means that nested paralism may have a more limited amount of threads.
- Parameters
-
threadCount | max amount of thread to use. If 0, uses the number of thread of the pool. If greater than the number of thread of the pool, uses the number of thread of the pool. |
- Returns
- A proxy.
◆ GetThreadId()
std::size_t vtk::detail::smp::vtkSMPThreadPool::GetThreadId |
( |
| ) |
const |
|
noexcept |
Get caller proxy thread virtual ID.
This function must be called from a proxy thread. If this function is called from non proxy thread, returns ExternalThreadID
. Valid proxy thread virtual ID are always >= 2
◆ IsParallelScope()
bool vtk::detail::smp::vtkSMPThreadPool::IsParallelScope |
( |
| ) |
const |
|
noexcept |
Returns true when called from a proxy thread, false otherwise.
◆ GetSingleThread()
bool vtk::detail::smp::vtkSMPThreadPool::GetSingleThread |
( |
| ) |
const |
Returns true for a single proxy thread, false for the others.
◆ ThreadCount()
std::size_t vtk::detail::smp::vtkSMPThreadPool::ThreadCount |
( |
| ) |
const |
|
noexcept |
Returns number of system thread used by the thread pool.
◆ GetInstance()
◆ ExternalThreadID
constexpr std::size_t vtk::detail::smp::vtkSMPThreadPool::ExternalThreadID = 1 |
|
staticconstexpr |
Value returned by GetThreadID
when called by a thread that does not belong to the pool.
Definition at line 130 of file vtkSMPThreadPool.h.
The documentation for this class was generated from the following file: