rte_atomic API compatibility & standard atomics
Tyler Retzlaff
roretzla at linux.microsoft.com
Mon Mar 27 21:39:15 CEST 2023
Hi folks,
I don't think we discussed it specifically but what is the expectation
in relation to converting to standard atomics and compatibility of the
legacy rte_atomic APIs?
We can't really convert the inline function implementations of the
rte_atomic APIs because doing so would break compatibility. This is
because if the implementation uses standard atomics APIs then we are
required to pass _Atomic types to the generic atomic intrinsics.
We can choose to just leave the rte_atomic API implementations as they
are using the GCC builtins and i'm fine with that, but I do need some
help with what to do with msvc then since it doesn't have those
builtins.
The options seem to be as follows.
1.
Just cast the non-atomic types in the rte_atomic APIs implementation
to _Atomic which may work but i'm pretty sure is undefined behavior since
you can't qualify a non _Atomic type to suddenly be _Atomic.
2.
We could conditionally compile (hide) the legacy rte_atomic APIs when
msvc is in use, this seems not bad since there technically aren't any
Windows/MSVC consumers, but if someone wanted to port an existing
application they would have to adapt the code to avoid use of
rte_atomic.
For now I think the safest option is to go with 2 since it doesn't
impose any compatibility risk and conditional compilation only exists
until we deprecate and remove the old rte_atomic APIs.
Are there any other options i'm missing here?
Thanks
More information about the dev
mailing list