Skip to content

Please make peripheral steal() const #5334

@psusi2

Description

@psusi2

I found the need to use the CRC peripheral from multiple tasks. I thought: no problem, wrap it in a global mutex, and each task can acquire it when needed. How to initialize it though? You can't use the peripheral passed to main. But there is steal()! That should work. Alas, you can't initialize a static with steal() because it isn't marked as const.

It looks like the peripheral is an entirely theoretical construct of the type system and doesn't contain anything so steal() doesn't have to actually initialize anything, so there's no reason it couldn't be const.

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