![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
A wrapper that enables to store data in a way that prevents false cacheline sharing. More...
#include <agrum/base/core/threads/threadData.h>
Public Types | |
| using | data_type = std::conditional< std::is_scalar< T_DATA >::value, T_DATA, T_DATA& > |
| the return types of accessors: T_DATA if scalar, else T_DATA& | |
Public Member Functions | |
Constructors / Destructors | |
| ThreadData (const T_DATA &theData) | |
| default constructor | |
| ThreadData (T_DATA &&theData) | |
| default constructor | |
| ThreadData (const ThreadData< T_DATA > &from) | |
| copy constructor | |
| ThreadData (ThreadData< T_DATA > &&from) | |
| move constructor | |
| ~ThreadData () | |
| destructor | |
Operators | |
| ThreadData< T_DATA > & | operator= (const ThreadData< T_DATA > &from) |
| copy operator | |
| ThreadData< T_DATA > & | operator= (ThreadData< T_DATA > &&from) |
| move operator | |
| bool | operator== (const ThreadData< T_DATA > &from) |
| equality operator | |
| bool | operator== (const T_DATA &from) |
| equality operator | |
| bool | operator!= (const ThreadData< T_DATA > &from) |
| inequality operator | |
| bool | operator!= (const T_DATA &from) |
| inequality operator | |
Accessors | |
| using | data_pointer |
| the data we wish to store without cacheline parallel problem | |
| T_DATA | data |
| the data we wish to store without cacheline parallel problem | |
| data_type | operator* () |
| easy accessor | |
| template<typename X = T_DATA> | |
| std::enable_if_t< std::is_pointer< X >::value, data_pointer > | operator-> () |
| the data we wish to store without cacheline parallel problem | |
| template<typename X = T_DATA> | |
| std::enable_if_t< !std::is_pointer< X >::value, data_pointer > | operator-> () |
| the data we wish to store without cacheline parallel problem | |
A wrapper that enables to store data in a way that prevents false cacheline sharing.
When several threads access to some shared containers like vectors, it may be the case that they access some data within these containers that are too close, which results in false sharing of the cacheline. By wrapping the data into a ThreadData, we guarantee that no false sharing can occur.
To create a wrapper data, simply use wrapped_data = ThreadData (data) and To get the data wrapped, use wrapped_data.data;
Definition at line 77 of file threadData.h.
| using gum::ThreadData< T_DATA >::data_pointer |
the data we wish to store without cacheline parallel problem
Definition at line 144 of file threadData.h.
| using gum::ThreadData< T_DATA >::data_type = std::conditional< std::is_scalar< T_DATA >::value, T_DATA, T_DATA& > |
the return types of accessors: T_DATA if scalar, else T_DATA&
Definition at line 79 of file threadData.h.
|
inline |
default constructor
Definition at line 87 of file threadData.h.
References data.
Referenced by ThreadData(), ThreadData(), operator!=(), operator=(), operator=(), and operator==().
|
inline |
|
inline |
copy constructor
Definition at line 93 of file threadData.h.
References ThreadData(), and data.
|
inline |
move constructor
Definition at line 96 of file threadData.h.
References ThreadData(), and data.
|
inline |
|
inline |
|
inline |
inequality operator
Definition at line 128 of file threadData.h.
References ThreadData(), and data.
|
inline |
|
inline |
the data we wish to store without cacheline parallel problem
Definition at line 155 of file threadData.h.
References data.
|
inline |
the data we wish to store without cacheline parallel problem
Definition at line 150 of file threadData.h.
References data.
|
inline |
copy operator
Definition at line 110 of file threadData.h.
References ThreadData(), and data.
|
inline |
move operator
Definition at line 116 of file threadData.h.
References ThreadData(), and data.
|
inline |
|
inline |
equality operator
Definition at line 122 of file threadData.h.
References ThreadData(), and data.
| T_DATA gum::ThreadData< T_DATA >::data |
the data we wish to store without cacheline parallel problem
Definition at line 160 of file threadData.h.
Referenced by ThreadData(), ThreadData(), ThreadData(), ThreadData(), operator!=(), operator!=(), operator*(), operator->(), operator=(), operator=(), operator==(), and operator==().