Skip to content

view.Info contains three mutex values which are copied by the flight package #8

@ghost

Description

Commit: e99a706
Code: core/view/view.go

In the view.Info struct there are three fields of type sync.RWMutex - mutex, extendMutex and modifyMutex.

All of these mutexes are used to manage access to reference type fields in the struct - templateCollection, extendList and modifyList. If the struct is copied, the mutexes are copied but the maps and slice referenced by the fields are not. Two goroutines with different copies of the view.Info struct will be working with the same maps and slice but different mutexes. A lock acquired by one goroutine will not prevent access to these fields by another goroutine with a different copy of view.Info.

As I understand it, the mutexes should be outside the struct, in the package.

Edit: I made the first version of this issue far more complicated than it needed to be. Hopefully this is clearer.

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