Skip to content

Should register fn modify be unsafe? #183

Description

@jonathanpallant

The system registers have associated functions which do a read-modify-write cycle, but the functions are not unsafe to call and do not require the (unsafe) creation of an object that represents unique ownership of that register. This means safe code can have undefined behaviour, through the main thread doing a modify on a register, which is interrupted by an exception that also does a modify on the same register. That's not ideal.

Rather than model each register as an object with a unique owner, I think the modify function should be unsafe.

I think the read and write functions can remain safe, because the effect would be no worse than conflicting store operations on an atomic variable (which is safe).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions