Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

The trait should be redesigned to be a better fit for intended use cases #12

@jonas-schievink

Description

@jonas-schievink

After publishing the initial version, I noticed a few things:

  • The trait was, for some reason, designed to be implemented for references. This is very confusing and almost no other trait does this. I believe the original motivation was to make it harder to cause deadlocks, but implementations will usually be for &SomeMutex, which means you can still deadlock. This also makes the lock method hard to call.
  • The trait confuses the "interior mutability" aspect of mutexes with the "making Send data Sync" aspect, leading to expensive implementations (eg. Added arch specific mutex implementation cortex-m#209). Since we already have plenty of data structures like cells for interior mutability, it is more important to cover the "making Send data Sync" part.

I'm not yet sure how the trait should look, and what it would take to make it still useful for RTFM etc., but I think the current design is not optimal.

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