On Sunday, April 14, 2019 at 8:16:11 PM UTC+2, Matt Harden wrote: > > No, you don't need sync/atomic. The mutex is sufficient. By the way, you > should put the mutex inside of guardedState, next to the data being > guarded. Had you done that originally, Go Vet would have complained about > you passing guardedState by value (mutexes should never by copied). > > https://play.golang.org/p/yuYjhSzdBoQ > > > I don't think so. As far as I understand the mutex is used to protect the access to the global gState variable, so it should be next to it, as with the original implementation in https://play.golang.org/p/6aQYNjojyBD
> [...] Manlio -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.