PolyFEM
Loading...
Searching...
No Matches
polyfem::utils::ScopedThreadLimit Class Reference

Restrict parallel work on the current thread and its CPP worker calls. More...

#include <par_for.hpp>

Public Member Functions

 ScopedThreadLimit (const size_t limit)
 
 ~ScopedThreadLimit ()
 
 ScopedThreadLimit (const ScopedThreadLimit &)=delete
 
ScopedThreadLimit & operator= (const ScopedThreadLimit &)=delete
 

Static Public Member Functions

static size_t current ()
 

Private Attributes

size_t previous_
 

Static Private Attributes

static thread_local size_t limit_ = std::numeric_limits<size_t>::max()
 

Detailed Description

Restrict parallel work on the current thread and its CPP worker calls.

Definition at line 19 of file par_for.hpp.

Constructor & Destructor Documentation

◆ ScopedThreadLimit() [1/2]

polyfem::utils::ScopedThreadLimit::ScopedThreadLimit ( const size_t  limit)
inlineexplicit

Definition at line 22 of file par_for.hpp.

References limit_.

◆ ~ScopedThreadLimit()

polyfem::utils::ScopedThreadLimit::~ScopedThreadLimit ( )
inline

Definition at line 26 of file par_for.hpp.

References limit_, and previous_.

◆ ScopedThreadLimit() [2/2]

polyfem::utils::ScopedThreadLimit::ScopedThreadLimit ( const ScopedThreadLimit &  )
delete

Member Function Documentation

◆ current()

static size_t polyfem::utils::ScopedThreadLimit::current ( )
inlinestatic

Definition at line 29 of file par_for.hpp.

References limit_.

Referenced by polyfem::utils::get_n_threads().

Here is the caller graph for this function:

◆ operator=()

ScopedThreadLimit & polyfem::utils::ScopedThreadLimit::operator= ( const ScopedThreadLimit &  )
delete

Member Data Documentation

◆ limit_

thread_local size_t polyfem::utils::ScopedThreadLimit::limit_ = std::numeric_limits<size_t>::max()
inlinestaticprivate

Definition at line 32 of file par_for.hpp.

Referenced by current(), ScopedThreadLimit(), and ~ScopedThreadLimit().

◆ previous_

size_t polyfem::utils::ScopedThreadLimit::previous_
private

Definition at line 33 of file par_for.hpp.

Referenced by ~ScopedThreadLimit().


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