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)
29MULTIPLE THREADING MODELS CANNOT BE SIMULTANEOUSLY ACTIVE
64template <
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"
193 this->
reset(first, last);
228 middle = beginning + (ending - beginning)/2u;
Blocked range which can be subdivided and executed in parallel.
void reset(const const_iterator first, const const_iterator last)
Resets the StoredRange to contain [first,last).
const_iterator end() const
End of the range.
bool is_divisible() const
unsigned int grainsize() const
The grain size for the range.
const_iterator begin() const
Beginning of the range.
BlockedRange(const const_iterator first, const const_iterator last, const unsigned int new_grainsize=libMesh::default_grainsize())
Constructor.
void grainsize(const unsigned int &gs)
Set the grain size.
BlockedRange(const BlockedRange< T > &r)
Copy constructor.
BlockedRange(const unsigned int new_grainsize=libMesh::default_grainsize())
Constructor.
BlockedRange(BlockedRange< T > &r, Threads::split)
Splits the range r.
T const_iterator
Allows an StoredRange to behave like an STL container.
We use a class to turn perf logging off and on within threads, to be exception-safe and to avoid forc...
const bool _logging_was_enabled
Simple compatibility class for std::thread 'concurrent' execution.
bool joinable() const
Always joinable.
void join()
Join is a no-op, since the constructor blocked until completion.
NonConcurrentThread(Callable f)
Constructor.
We use a class to turn Threads::in_threads on and off, to be exception-safe.
RAIIAcquire(T &x, T new_x=new_x_default)
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!...
recursive_mutex recursive_mtx
A convenient recursive mutex object which can be used for obtaining locks.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
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
The libMesh namespace provides an interface to certain functionality in the library.
unsigned int default_grainsize()