Skip to content

Inconsistent thread safety implementation #2276

Closed
@neilt6

Description

@neilt6

Most of the new thread safe classes are using a single static mutex for all instances. This guarantees thread safety across multiple objects, but prevents multiple independent peripherals from being used simultaneously. Kind of inconvenient, but developers can override the virtual lock() and unlock() methods to disable the mutex so not a big deal.

However, AnalogOut, CAN, SPI, and Serial are using separate mutexes for each instance. This guarantees nothing unless the developer creates a single object and passes it around, which is not the way these objects have historically been used. Is this implementation a mistake, or by design?

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