Skip to content
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

CWG2970 [intro.races] Races in practice with volatile sig_atomic_t bit-fields #654

Open
hubert-reinterpretcast opened this issue Dec 17, 2024 · 1 comment

Comments

@hubert-reinterpretcast
Copy link

Full name of submitter (unless configured in github; will be published with the issue): Hubert Tong

Reference (section label): intro.races

Link to reflector thread (if any): N/A

Issue description:
https://wg21.link/intro.races#22 says:

Two accesses to the same object of type volatile std::sig_atomic_t do not result in a data race if both occur in the same thread, even if one or more occurs in a signal handler.

However: Bit-fields are objects (https://wg21.link/basic.types.general#4), and volatile std::sig_atomic_t bit-field accesses are subject to tearing in practice and, therefore, should formally receive the data-race treatment.

Suggested resolution:

Two accesses to the same non-bit-field object of type volatile std::sig_atomic_t do not result in a data race if both occur in the same thread, even if one or more occurs in a signal handler.

@jensmaurer
Copy link
Member

CWG2970

@jensmaurer jensmaurer changed the title [intro.races] Races in practice with volatile sig_atomic_t bit-fields CWG2970 [intro.races] Races in practice with volatile sig_atomic_t bit-fields Dec 17, 2024
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

No branches or pull requests

2 participants