taiki-e / atomic-maybe-uninit

Atomic operations on potentially uninitialized integers.

Home Page:https://docs.rs/atomic-maybe-uninit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider providing {has,no}_atomic_{8,16,32,64,128} helper macros

taiki-e opened this issue · comments

Without such helpers, it is difficult to determine which platform has which atomic operation.

Alternatives

  • Provide all operations on all platforms, but panic if not supported.
  • Provide lock-based fallbacks if not supported. This approach is adopted by C++ std::atomic, crossbeam AtomicCell, portable-atomic, etc., but there are problems such as global locks are not the best from a performance standpoint (although per-object locks cannot be used because it breaks API guarantees), adding extra binary size when it is not used, etc.