Skip to content

sync.Mutex double-unlock panic with rp2 multi-core #4988

Description

@mikesmitty

Edit: None of this is important info, better detail with stack traces down below

I'm assuming there's no implicit pointer indirection in TinyGo? I haven't dug that far into the compiler side of things yet, but as I've been testing out the multi-core functionality with a project I'm working on it's causing issues with sync.Mutex. Since the standard approach with sync.Mutex relies on implicit pointer indirection on the Lock/Unlock methods they're rendered useless and result in double-unlock panics in the case a function gets preempted while the mutex is locked:
> panic: sync: unlock of unlocked Mutex

I've worked around it in my code by just making all my mutexes explicitly pointer variables, but this one in particular is biting me while setting up two ADC channels in quick succession:

var adcLock sync.Mutex

var adcLock sync.Mutex

Metadata

Metadata

Assignees

No one assigned

    Labels

    rp2RP2350/RP2040

    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