We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ac3d1f9 commit 59e8c0bCopy full SHA for 59e8c0b
serialport.go
@@ -274,11 +274,13 @@ func (p *serport) writerRaw() {
274
h.broadcastSys <- []byte(msgstr)
275
}
276
277
-var spHandlerLock sync.Mutex
+// This lock is used to prevent multiple threads from trying to open the same port at the same time.
278
+// It presents issues with the serial port driver on some OS's: https://github.com/arduino/arduino-create-agent/issues/1031
279
+var spHandlerOpenLock sync.Mutex
280
281
func spHandlerOpen(portname string, baud int, buftype string) {
- spHandlerLock.Lock()
- defer spHandlerLock.Unlock()
282
+ spHandlerOpenLock.Lock()
283
+ defer spHandlerOpenLock.Unlock()
284
285
log.Print("Inside spHandler")
286
0 commit comments