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

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

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

Destructor.

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

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

Member Function Documentation

Proxy& vtk::detail::smp::vtkSMPThreadPool::Proxy::operator= ( const Proxy )
delete
Proxy& vtk::detail::smp::vtkSMPThreadPool::Proxy::operator= ( Proxy &&  )
noexcept
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.

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

Add a job to the thread pool queue.

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.

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 Function Documentation

friend class vtkSMPThreadPool
friend

Definition at line 97 of file vtkSMPThreadPool.h.


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