stianeikeland / go-rpio

:electric_plug: Raspberry Pi GPIO library for go-lang
MIT License
2.16k stars 221 forks source link

How to call async #87

Open rlimberger opened 10 months ago

rlimberger commented 10 months ago

Hi, thanks for this great library.

Im trying to use this in the context of a web server (Chi). As a result multiple, possibly concurrent requests could lead to the rpio library being called simultaneously. This sometimes gives the following error:

unexpected fault address 0x7f47759008

I tried wrapping all the rpio calls with a Mutex but that didnt help.

Are there any best practices how to handle concurrency with multiple go routines for rpio?

Thanks.