Files
go-serial/serial_unix.go
angri 1b760a82af allow Close() to be called from other goroutine than Read
The only way to interrupt running Read() method of io.Reader is to call
Close from another goroutine. What happens is that go runtime builtin
race detector complains about unsynchronised access to "opened" member,
which is set in Close and checked in Read.

It doesn't seem to be dangerous, but 1) you never know, and 2) it makes
your life more difficult when you need to debug some other data races in
a complex project that uses serial.

Proposed fix changes simple access to "opened" to atomic operations.
It's also supposed to fix #38
2020-04-19 01:12:48 +02:00

9.4 KiB