Skip to content

Inefficiency in the CriticalSection API #7

@TethysSvensson

Description

@TethysSvensson

It seems inefficient to pass around a &'a CriticalSection, since reference to zero-sized types are not themselves zero-sized in rust. In a lot of cases, this would be compiled out, but it is not guaranteed.

It would be better if CriticalSection was defined like this:

struct CriticalSection<'a> {
    _0: PhantomData<&'a ()>,
}

Instead of passing &'a CriticalSection you would then pass a CriticalSection<'a> around. This would have the same purpose

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