Skip to content

POC: Explicit memory ordering #13974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

jhawthorn
Copy link
Member

This adds atomic helpers which use explicit memory ordering. For example:

rbimpl_atomic_sub_explicit(&set->size, 1, RUBY_ATOMIC_RELAXED);

I defined these using macros in hopes of making these easier and less error prone to declare for a variety of operations and types. Explicit ordering is only available for platforms with stdatomic.h (C11) or GCC's __atomic. When not available they fall back to the non-explicit rbimpl_* definitions which should implement the strictest SEQ_CST ordering.

Note that these are being added to ruby_atomic.h, so these are only available within the Ruby VM but not native extensions.

"store" is the terminology the C11 standard uses, which allows us to use
this as a fallback.

This only changes the private rbimpl_ version of the method,
RUBY_ATOMIC_SET et al. keep the same name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy