Skip to content

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

Closed
cplusplus/draft
#7647
@hubert-reinterpretcast

Description

@hubert-reinterpretcast

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions