keyboard icon indicating copy to clipboard operation
keyboard copied to clipboard

Data race in `keyboard.Listen()`

Open gheinrich-dd opened this issue 1 year ago • 0 comments

Hello, when using this package with race detection turned on for unit tests, I ran into the following data race:

WARNING: DATA RACE
Write at 0x00c00020a5cf by goroutine 13:
  atomicgo.dev/keyboard.Listen.func1()
      external/dev_atomicgo_keyboard/keyboard.go:81 +0x10c

Previous read at 0x00c00020a5cf by goroutine 11:
  atomicgo.dev/keyboard.Listen()
      external/dev_atomicgo_keyboard/keyboard.go:97 +0x18c

Specifically, I think it has to do with the sharing stopRoutine variable between the go routine and the loop further down inside the Listen() function.

gheinrich-dd avatar Jul 18 '24 20:07 gheinrich-dd