Skip to content

stdlib/sync: Match Mutex size with upstream Go #4815

@soypat

Description

@soypat

People are trying to build stuff that uses modernc.org/memory package. There is one assumption made by this package- it requires a size of 8 for sync.Mutex.

The current implementation of sync.Mutex is based on the task.Mutex which is composed of a bool and a Stack (pointer). This gives the Mutex a size of 16 bytes on 64-bit aligned systems while in upstream Go it is 8 bytes.

TinyGo data structures

Go data structures

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