1 #ifndef DUNE_FEM_THREADSAFEVALUES_HH
2 #define DUNE_FEM_THREADSAFEVALUES_HH
18 #ifdef USE_SMP_PARALLEL
19 std::vector< T > value_;
28 template<
class ...Args >
30 #ifdef USE_SMP_PARALLEL
33 : value_( std::forward< Args >( args )... )
40 #ifdef USE_SMP_PARALLEL
59 assert( thread <
size() );
60 #ifdef USE_SMP_PARALLEL
61 assert( thread < value_.size() );
64 #ifdef USE_SMP_PARALLEL
72 assert( thread <
size() );
73 #ifdef USE_SMP_PARALLEL
74 assert( thread < value_.size() );
77 #ifdef USE_SMP_PARALLEL
Definition: bindguard.hh:11
Definition: threadmanager.hh:45
static int maxThreads()
return maximal number of threads possbile in the current run
Definition: threadmanager.hh:59
static int thread()
return thread number
Definition: threadmanager.hh:65
ThreadSafeValue realizes thread safety for a given variable by creating an instance of this variable ...
Definition: threadsafevalue.hh:17
size_t size() const
return number of threads
Definition: threadsafevalue.hh:47
T ValueType
type of value to be thread safe
Definition: threadsafevalue.hh:25
ValueType & operator*()
return reference to thread private value
Definition: threadsafevalue.hh:50
ValueType & operator[](const unsigned int thread)
return reference to private value for given thread number
Definition: threadsafevalue.hh:58
ThreadSafeValue()
default constructor
Definition: threadsafevalue.hh:38
ThreadSafeValue(Args &&...args)
constructor initializing values for all threads given a init value
Definition: threadsafevalue.hh:29