Skip to content

Commit decd813

Browse files
committed
Synchronize multiple serial-port update request
1 parent c1f7818 commit decd813

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: serial.go

+6
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,13 @@ func discoverLoop() {
174174
}()
175175
}
176176

177+
var serialEnumeratorLock sync.Mutex
178+
177179
func updateSerialPortList() {
180+
if !serialEnumeratorLock.TryLock() {
181+
return
182+
}
183+
defer serialEnumeratorLock.Unlock()
178184
ports, err := enumerateSerialPorts()
179185
if err != nil {
180186
// TODO: report error?

0 commit comments

Comments
 (0)