Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here are the changes I made:
Add documentation (originally written by @ticki in Major-release candidate #122)
Make the padding trick more readable. Though I am not sure of its correctness (https://github.com/jeehoonkang/crossbeam/blob/cachepadded/src/cache_padded.rs#L15). Would anyone please verify it? Also I am wondering if there is a documentation on this trick.
Split pad from the marker in
CachePadded
.Add an assertion in
assert_valid
.Remove validity check when dereferencing and dropping
CachePadded
.Remaining questions:
Is it better to describe the cache line size as
CONST * sizeof(usize)
? Why not just write down the size in bytes?I think eventually
CACHE_LINE
should depend on the (micro-)architecture. But I cannot find any existing C/C++ library on it. Do anyone have an idea/pointer on this?Alternatively, we can get the cache line size from the environmental variable, with 64 bytes as default.
How to support
T
whose size is bigger thanCACHE_LINE
? It is needed when we want the cache line size to be 64 bytes, assizeof(Participant)
> 64.