[PATCH] Want feedback for potential implementation of P2643R2 atomic features

Teodor Spæren teodor@sparen.no
Sun Apr 14 20:15:34 GMT 2024


Hello!

Earlier I sent an email about wanting to try to implement the new 
features described in 
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p2643r2.html

I've now gone and done that. I've added the support for all the commands 
for floats, and integer values, as well as atomic_flag. I've added tests 
for atomic_integer. I will of course finish all the types and add tests 
for all the types, but I wanted to know if this is work that is wanted 
or if it's to early to implement, and I also wanted some feedback.

I have a couple of questions:

1. How should I feature test for this to be enabled or not? For the 
`wait` and `notify` functionality #if __glibcxx_atomic_wait is used,
should I guard this behind a new type of flag?


2. How is the formatting? Is there a command to format all the files?


3. What timeout values should I use for tests? I don't want the waiting 
to take 2seconds, but I also don't want the tests to fail 
intermittently. I've tried to use 60ms buffer now, but this seems like a 
lot to me.

4. Why does "__atomic_wait_address_for_v" take the "old" parameter by 
rvalue reference? Immediately we call a function which takes the 
parameter by value. Is this just an oversight or is there some semantics 
here that I'm not aware of?


I've attached the patches in what I hope is a good format, I hope that 
I've not butchered this completely!

Best regards,
Teodor Spæren
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Add-tests-for-atomic-integral.patch
Type: text/x-patch
Size: 17853 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20240414/d415dd32/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Add-atomic-wait-for-floating-points.patch
Type: text/x-patch
Size: 4955 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20240414/d415dd32/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-atomic-waits-to-atomic_flag.patch
Type: text/x-patch
Size: 6187 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20240414/d415dd32/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-atomic-options-for-integers.patch
Type: text/x-patch
Size: 7508 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20240414/d415dd32/attachment-0007.bin>


More information about the Libstdc++ mailing list