class to ensure cacheline-aligned storage for an object.
More...
#include <taskflow/utility/os.hpp>
|
| T & | get () |
| | accesses the underlying object
|
| |
| const T & | get () const |
| | accesses the underlying object as a constant reference
|
| |
|
|
T | data |
| | The stored object, aligned to twice the cacheline size.
|
| |
template<typename T>
class tf::CachelineAligned< T >
class to ensure cacheline-aligned storage for an object.
- Template Parameters
-
| T | The type of the stored object. |
This utility class aligns the stored object data to twice the size of a cacheline. The alignment improves performance by optimizing data access in cache-sensitive scenarios.
std::thread t1([&]{ counter1.
get() = 1; });
std::thread t2([&]{ counter2.
get() = 2; });
t1.join();
t2.join();
class to ensure cacheline-aligned storage for an object.
Definition os.hpp:148
T & get()
accesses the underlying object
Definition os.hpp:160
◆ get() [1/2]
accesses the underlying object
- Returns
- a reference to the underlying object.
◆ get() [2/2]
accesses the underlying object as a constant reference
- Returns
- a constant reference to the underlying object.
The documentation for this class was generated from the following file: