Skip to content

Commit cec108e

Browse files
committed
Synchronize multiple serial-port update request
1 parent f123ca9 commit cec108e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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)