mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
Align the first element of the Waiter struct instead of padding it. This reduces its memory footprint a bit while achieving the goal of preventing false sharing
This commit is contained in:
parent
5b77481d58
commit
c3c8ad8046
@ -169,7 +169,8 @@ class EventCount {
|
||||
|
||||
class Waiter {
|
||||
friend class EventCount;
|
||||
std::atomic<Waiter*> next;
|
||||
// Align to 128 byte boundary to prevent false sharing with other Waiter objects in the same vector.
|
||||
EIGEN_ALIGN_TO_BOUNDARY(128) std::atomic<Waiter*> next;
|
||||
std::mutex mu;
|
||||
std::condition_variable cv;
|
||||
uint64_t epoch;
|
||||
@ -179,8 +180,6 @@ class EventCount {
|
||||
kWaiting,
|
||||
kSignaled,
|
||||
};
|
||||
// Prevent false sharing with other Waiter objects in the same vector.
|
||||
char pad_[128];
|
||||
};
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user