Skip to content

Fix concurrency problem in Board.buildConfigOptionsStructures #1972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions arduino/cores/board.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package cores
import (
"fmt"
"strings"
"sync"

"github.com/arduino/go-properties-orderedmap"
)
Expand All @@ -27,6 +28,7 @@ type Board struct {
BoardID string
Properties *properties.Map `json:"-"`
PlatformRelease *PlatformRelease `json:"-"`
configOptionsMux sync.Mutex
configOptions *properties.Map
configOptionValues map[string]*properties.Map
configOptionProperties map[string]*properties.Map
Expand Down Expand Up @@ -69,6 +71,8 @@ func (b *Board) String() string {
}

func (b *Board) buildConfigOptionsStructures() {
b.configOptionsMux.Lock()
defer b.configOptionsMux.Unlock()
if b.configOptions != nil {
return
}
Expand Down