19 #ifndef LIBMESH_THREADS_H 20 #define LIBMESH_THREADS_H 23 #include "libmesh/libmesh_config.h" 24 #include "libmesh/libmesh_common.h" 28 #if defined(LIBMESH_HAVE_TBB_API) && defined(LIBMESH_HAVE_PTHREAD) 29 MULTIPLE THREADING MODELS CANNOT BE SIMULTANEOUSLY ACTIVE
64 template <
typename T, T new_x_default = T(),
bool assert_change = false>
97 #ifndef LIBMESH_ENABLE_PERFORMANCE_LOGGING 121 template <
typename Callable>
144 #define LIBMESH_SQUASH_HEADER_WARNING 145 #ifdef LIBMESH_HAVE_TBB_API 146 # include "libmesh/threads_tbb.h" 147 #elif LIBMESH_HAVE_PTHREAD 148 # include "libmesh/threads_pthread.h" 150 # include "libmesh/threads_none.h" 164 template <
typename T>
193 this->
reset(first, last);
228 middle = beginning + (ending - beginning)/2u;
306 #endif // LIBMESH_THREADS_H Simple compatibility class for std::thread 'concurrent' execution.
NonConcurrentThread(Callable f)
Constructor.
void join()
Join is a no-op, since the constructor blocked until completion.
const_iterator end() const
End of the range.
recursive_mutex recursive_mtx
A convenient recursive mutex object which can be used for obtaining locks.
We use a class to turn Threads::in_threads on and off, to be exception-safe.
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
bool is_divisible() const
const bool _logging_was_enabled
The libMesh namespace provides an interface to certain functionality in the library.
void reset(const const_iterator first, const const_iterator last)
Resets the StoredRange to contain [first,last).
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!Threadsin_thre...
We use a class to turn perf logging off and on within threads, to be exception-safe and to avoid forc...
Blocked range which can be subdivided and executed in parallel.
unsigned int grainsize() const
The grain size for the range.
void grainsize(const unsigned int &gs)
Set the grain size.
const_iterator begin() const
Beginning of the range.
bool joinable() const
Always joinable.
T const_iterator
Allows an StoredRange to behave like an STL container.
RAIIAcquire(T &x, T new_x=new_x_default)
unsigned int default_grainsize()
BlockedRange(const unsigned int new_grainsize=libMesh::default_grainsize())
Constructor.
BlockedRange(const BlockedRange< T > &r)
Copy constructor.
int active_threads
An integer which is set to the number of active threads when we are in a Threads:: parallel operation...
RAIIAcquire< bool, true, true > BoolAcquire
BlockedRange(BlockedRange< T > &r, Threads::split)
Splits the range r.
BlockedRange(const const_iterator first, const const_iterator last, const unsigned int new_grainsize=libMesh::default_grainsize())
Constructor.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.