ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
colmap::ThreadPool Class Reference

#include <threading.h>

Public Member Functions

 ThreadPool (const int num_threads=kMaxNumThreads)
 
 ~ThreadPool ()
 
size_t NumThreads () const
 
template<class func_t , class... args_t>
auto AddTask (func_t &&f, args_t &&... args) -> std::future< typename std::result_of< func_t(args_t...)>::type >
 
void Stop ()
 
void Wait ()
 
std::thread::id GetThreadId () const
 
int GetThreadIndex ()
 

Static Public Attributes

static const int kMaxNumThreads = -1
 

Detailed Description

Definition at line 171 of file threading.h.

Constructor & Destructor Documentation

◆ ThreadPool()

colmap::ThreadPool::ThreadPool ( const int  num_threads = kMaxNumThreads)
explicit

Definition at line 186 of file threading.cc.

References colmap::GetEffectiveNumThreads().

◆ ~ThreadPool()

colmap::ThreadPool::~ThreadPool ( )

Definition at line 196 of file threading.cc.

References Stop().

Member Function Documentation

◆ AddTask()

template<class func_t , class... args_t>
auto colmap::ThreadPool::AddTask ( func_t &&  f,
args_t &&...  args 
) -> std::future<typename std::result_of<func_t(args_t...)>::type>

◆ GetThreadId()

std::thread::id colmap::ThreadPool::GetThreadId ( ) const

Definition at line 260 of file threading.cc.

Referenced by GetThreadIndex().

◆ GetThreadIndex()

int colmap::ThreadPool::GetThreadIndex ( )

Definition at line 264 of file threading.cc.

References GetThreadId().

Referenced by BOOST_AUTO_TEST_CASE().

◆ NumThreads()

size_t colmap::ThreadPool::NumThreads ( ) const
inline

Definition at line 296 of file threading.h.

◆ Stop()

void colmap::ThreadPool::Stop ( )

Definition at line 198 of file threading.cc.

References std::swap().

Referenced by BOOST_AUTO_TEST_CASE(), and ~ThreadPool().

◆ Wait()

void colmap::ThreadPool::Wait ( )

Member Data Documentation

◆ kMaxNumThreads

const int colmap::ThreadPool::kMaxNumThreads = -1
static

Definition at line 173 of file threading.h.


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