![]() |
aGrUM 3.1.1
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 | |
| template<typename X> | |
| std::enable_if_t< std::is_pointer< X >::value, typename ThreadData< T_DATA >::data_pointer > | operator-> () |
| template<typename X> | |
| std::enable_if_t< !std::is_pointer< X >::value, typename ThreadData< T_DATA >::data_pointer > | operator-> () |
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 ()=default | |
| 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) const |
| equality operator | |
| bool | operator== (const T_DATA &from) const |
| equality operator | |
| bool | operator!= (const ThreadData< T_DATA > &from) const |
| inequality operator | |
| bool | operator!= (const T_DATA &from) const |
| 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 138 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.
| gum::ThreadData< T_DATA >::ThreadData | ( | const T_DATA & | theData | ) |
default constructor
Definition at line 49 of file threadData_inl.h.
References data.
Referenced by ThreadData(), ThreadData(), ~ThreadData(), operator!=(), operator=(), operator=(), and operator==().
| gum::ThreadData< T_DATA >::ThreadData | ( | T_DATA && | theData | ) |
| gum::ThreadData< T_DATA >::ThreadData | ( | const ThreadData< T_DATA > & | from | ) |
copy constructor
Definition at line 55 of file threadData_inl.h.
References ThreadData(), and data.
| gum::ThreadData< T_DATA >::ThreadData | ( | ThreadData< T_DATA > && | from | ) |
move constructor
Definition at line 58 of file threadData_inl.h.
References ThreadData(), and data.
|
default |
| bool gum::ThreadData< T_DATA >::operator!= | ( | const T_DATA & | from | ) | const |
| bool gum::ThreadData< T_DATA >::operator!= | ( | const ThreadData< T_DATA > & | from | ) | const |
inequality operator
Definition at line 84 of file threadData_inl.h.
References ThreadData(), and data.
| ThreadData< T_DATA >::data_type gum::ThreadData< T_DATA >::operator* | ( | ) |
| std::enable_if_t< !std::is_pointer< X >::value, data_pointer > gum::ThreadData< T_DATA >::operator-> | ( | ) |
the data we wish to store without cacheline parallel problem
| std::enable_if_t< std::is_pointer< X >::value, data_pointer > gum::ThreadData< T_DATA >::operator-> | ( | ) |
the data we wish to store without cacheline parallel problem
Referenced by operator->().
| std::enable_if_t< !std::is_pointer< X >::value, typename ThreadData< T_DATA >::data_pointer > gum::ThreadData< T_DATA >::operator-> | ( | ) |
Definition at line 104 of file threadData_tpl.h.
References data, and operator->().
| std::enable_if_t< std::is_pointer< X >::value, typename ThreadData< T_DATA >::data_pointer > gum::ThreadData< T_DATA >::operator-> | ( | ) |
Definition at line 97 of file threadData_tpl.h.
References data, and operator->().
|
default |
copy operator
Definition at line 62 of file threadData_inl.h.
References ThreadData(), and data.
| ThreadData< T_DATA > & gum::ThreadData< T_DATA >::operator= | ( | ThreadData< T_DATA > && | from | ) |
move operator
Definition at line 68 of file threadData_inl.h.
References ThreadData(), and data.
| bool gum::ThreadData< T_DATA >::operator== | ( | const T_DATA & | from | ) | const |
| bool gum::ThreadData< T_DATA >::operator== | ( | const ThreadData< T_DATA > & | from | ) | const |
equality operator
Definition at line 74 of file threadData_inl.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 150 of file threadData.h.
Referenced by ThreadData(), ThreadData(), ThreadData(), ThreadData(), operator!=(), operator!=(), operator*(), operator->(), operator=(), operator=(), operator==(), and operator==().