Skip to content

Tracking Issue for atomic volatile operations (atomic_volatile) #158947

Description

@RalfJung

Feature gate: #![feature(atomic_volatile)]

This is a tracking issue for atomic volatile operations

Public API

// Not actually a generic impl, but you get the idea.
impl Atomic<T> {
  /// Convenient method to create a raw pointer to `Atomic<T>` suitable for volatile accesses.  
  pub fn from_ptr_raw(ptr: *mut T) -> *const Self;

  /// Performs a volatile atomic load of the given `order`.
  pub unsafe fn load_volatile(self: *const Self, order: Ordering) -> T;
  /// Performs a volatile atomic store of the given `order`.
  pub unsafe fn store_volatile(self: *const Self, val: T, order: Ordering);
}

Steps / History

(Remember to update the S-tracking-* label when checking boxes.)

Unresolved Questions

  • Currently the API uses arbitrary_self_types_pointers. Are we okay with that or would it be bad to expose that on stable?
  • On LLVM 22 and older, we don't correctly handle atomic volatile loads that trap. Adding the same black_box we add for non-atomic volatile loads is tricky because of how the code is structured in the backend. Maybe we should just wait until the minimum LLVM version is 23 before stabilizing this...

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions