Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
87780d79
Unverified
Commit
87780d79
authored
Jul 29, 2019
by
Massimiliano Pippi
Committed by
GitHub
Jul 29, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sync board list to avoid race conditions (#308)
* sync board list to avoid race conditions * properly unlock mutex
parent
a6fdfea5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
arduino/discovery/discovery.go
arduino/discovery/discovery.go
+7
-0
No files found.
arduino/discovery/discovery.go
View file @
87780d79
...
...
@@ -23,6 +23,7 @@ import (
"io"
"os/exec"
"strings"
"sync"
"time"
"github.com/arduino/arduino-cli/arduino/cores"
...
...
@@ -33,6 +34,7 @@ import (
// Discovery is an instance of a discovery tool
type
Discovery
struct
{
sync
.
Mutex
ID
string
in
io
.
WriteCloser
out
io
.
ReadCloser
...
...
@@ -88,6 +90,11 @@ func (d *Discovery) Start() error {
// List retrieve the port list from this discovery
func
(
d
*
Discovery
)
List
()
([]
*
BoardPort
,
error
)
{
// ensure the connection to the discoverer is unique to avoid messing up
// the messages exchanged
d
.
Lock
()
defer
d
.
Unlock
()
if
_
,
err
:=
d
.
in
.
Write
([]
byte
(
"LIST
\n
"
));
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"sending LIST command to discovery: %s"
,
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment