Go to the documentation of this file.
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
77 template <
typename Callable>
100 #define LIBMESH_SQUASH_HEADER_WARNING
101 #ifdef LIBMESH_HAVE_TBB_API
102 # include "libmesh/threads_tbb.h"
103 #elif LIBMESH_HAVE_PTHREAD
104 # include "libmesh/threads_pthread.h"
106 # include "libmesh/threads_none.h"
120 template <
typename T>
146 const unsigned int new_grainsize = 1000) :
149 this->
reset(first, last);
184 middle = beginning + (ending - beginning)/2u;
262 #endif // LIBMESH_THREADS_H
bool is_divisible() const
Blocked range which can be subdivided and executed in parallel.
unsigned int grainsize() const
The grain size for the range.
recursive_mutex recursive_mtx
A convenient recursive mutex object which can be used for obtaining locks.
The libMesh namespace provides an interface to certain functionality in the library.
void grainsize(const unsigned int &gs)
Set the grain size.
NonConcurrentThread(Callable f)
Constructor.
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
bool joinable() const
Always joinable.
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!...
BlockedRange(const BlockedRange< T > &r)
Copy constructor.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
BlockedRange(BlockedRange< T > &r, Threads::split)
Splits the range r.
BlockedRange(const const_iterator first, const const_iterator last, const unsigned int new_grainsize=1000)
Constructor.
T const_iterator
Allows an StoredRange to behave like an STL container.
Simple compatibility class for std::thread 'concurrent' execution.
const_iterator end() const
End of the range.
void reset(const const_iterator first, const const_iterator last)
Resets the StoredRange to contain [first,last).
BlockedRange(const unsigned int new_grainsize=1000)
Constructor.
const_iterator begin() const
Beginning of the range.
void join()
Join is a no-op, since the constructor blocked until completion.
We use a class to turn Threads::in_threads on and off, to be exception-safe.