Skip to content

Conversation

@AlexGuteniev
Copy link
Contributor

@AlexGuteniev AlexGuteniev commented May 17, 2020

Fixes #2
Seems like it that simple to reuse existing atomic bases.

@AlexGuteniev

This comment was marked as resolved.

@AlexGuteniev
Copy link
Contributor Author

Still requires to handle generic atomic by a lock via contention table instead of internal lock.

@AlexGuteniev
Copy link
Contributor Author

So two main issues with this change is with mutex for bad size:

  • It is hard to eliminate data member without ABI-unsafe layout change and without [[no_unique_address]] (which we probably will not have soon). So embedded _Spinlock will probably stay for atomic_ref, but will not be used.
  • The mutexes for atomic_ref will have to reside in contention table, so apparently must go to a satellite DLL.

Due to the first issue it may make sense to make the best of the situation, and cache mutex reference in _Spinlock for atomic_ref. This will make (satellite) dll call only on construction, rather than on every operation.

Note that I'm assuming that embedded by value spinlock is not an option because independently constructed atomic_ref from the same object should be safe. Standard is not very clear on this though.

@AlexGuteniev AlexGuteniev marked this pull request as ready for review May 17, 2020 15:41
@AlexGuteniev AlexGuteniev requested a review from a team as a code owner May 17, 2020 15:41
Copy link
Member

@StephanTLavavej StephanTLavavej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, very minor nitpicks.

AlexGuteniev and others added 3 commits August 12, 2020 11:54
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
@StephanTLavavej StephanTLavavej removed their assignment Aug 12, 2020
@BillyONeal
Copy link
Member

Thanks for contributing my favorite C++20 feature :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cxx20 C++20 feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P0019R8 atomic_ref

5 participants