VTK  9.4.20250114
Public Member Functions | Friends | List of all members
vtk::detail::smp::vtkSMPThreadPool::Proxy Class Referencefinal

Proxy class used to submit work to the thread pool. More...

#include <vtkSMPThreadPool.h>

Public Member Functions

 ~Proxy ()
 Destructor.
 
 Proxy (const Proxy &)=delete
 
Proxyoperator= (const Proxy &)=delete
 
 Proxy (Proxy &&) noexcept
 
Proxyoperator= (Proxy &&) noexcept
 
void Join ()
 Blocks calling thread until all jobs are done.
 
void DoJob (std::function< void()> job)
 Add a job to the thread pool queue.
 
std::vector< std::reference_wrapper< std::thread > > GetThreads () const
 Get a reference on all system threads used by this proxy.
 
bool IsTopLevel () const noexcept
 Return true is this proxy is allocated from a thread that does not belong to the pool.
 

Friends

class vtkSMPThreadPool
 

Detailed Description

Proxy class used to submit work to the thread pool.

A proxy act like a single thread pool, but it submits work to its parent thread pool. Using a proxy from multiple threads at the same time is undefined behaviour.

Note: Even if nothing prevent a proxy to be moved around threads, it should either be used in the creating thread or in a thread that does not belong to the pool, otherwise it may create a deadlock when joining.

Definition at line 59 of file vtkSMPThreadPool.h.

Constructor & Destructor Documentation

◆ ~Proxy()

vtk::detail::smp::vtkSMPThreadPool::Proxy::~Proxy ( )

Destructor.

Join must have been called since the last DoJob before destroying the proxy.

◆ Proxy() [1/2]

vtk::detail::smp::vtkSMPThreadPool::Proxy::Proxy ( const Proxy )
delete

◆ Proxy() [2/2]

vtk::detail::smp::vtkSMPThreadPool::Proxy::Proxy ( Proxy &&  )
noexcept

Member Function Documentation

◆ operator=() [1/2]

Proxy & vtk::detail::smp::vtkSMPThreadPool::Proxy::operator= ( const Proxy )
delete

◆ operator=() [2/2]

Proxy & vtk::detail::smp::vtkSMPThreadPool::Proxy::operator= ( Proxy &&  )
noexcept

◆ Join()

void vtk::detail::smp::vtkSMPThreadPool::Proxy::Join ( )

Blocks calling thread until all jobs are done.

Note: nested proxies may execute jobs on calling thread during this function to maximize parallelism.

◆ DoJob()

void vtk::detail::smp::vtkSMPThreadPool::Proxy::DoJob ( std::function< void()>  job)

Add a job to the thread pool queue.

◆ GetThreads()

std::vector< std::reference_wrapper< std::thread > > vtk::detail::smp::vtkSMPThreadPool::Proxy::GetThreads ( ) const

Get a reference on all system threads used by this proxy.

◆ IsTopLevel()

bool vtk::detail::smp::vtkSMPThreadPool::Proxy::IsTopLevel ( ) const
noexcept

Return true is this proxy is allocated from a thread that does not belong to the pool.

Friends And Related Symbol Documentation

◆ vtkSMPThreadPool

friend class vtkSMPThreadPool
friend

Definition at line 97 of file vtkSMPThreadPool.h.


The documentation for this class was generated from the following file: