forked from d36u9/async
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added CachelineAlignment to the queue traits
The purpose of the cacheline-size padding between class members is to avoid false sharing when threads modify the atomic members, but they do not have to be aligned exactly to the cacheline-size. The atomic members are very small (just 4 or 8 bytes) compared to the cacheline. As far as I can tell, their explicit alignment does not matter, they can be placed anywhere on the cacheline - we just need to ensure they are mapped to different cachelines. To avoid problems with misaligned dynamic allocation, the alignment must not be stricter than alignof(std::max_align_t), which is 16 bytes on x86_64 Linux. The value was added to the traits structs. Fixes d36u9#1
- Loading branch information
Showing
2 changed files
with
22 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters