Argh I messed up the title. It should be "Should sync.Once implement sync.Locker?" Oh well...
On Friday, April 9, 2021 at 2:07:00 PM UTC-4 aind...@gmail.com wrote: > I've often been in situations where I've wanted to store and error or some > other signal once, but wanted reads to the stored value to be synchronized. > I've often ended up introducing a secondary mutex, or reimplementing the > slow path of sync.Once. This is a common pattern I see across many Go > codebases, including the standard library for example: > https://golang.org/src/io/pipe.go. > > Given this, would it be beneficial for sync.Once to implement Locker? This > would allow the mutex to be reused to synchronize access to the value being > stored. > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/bdbf8e60-73b3-4703-bfa3-83eb15fd8f00n%40googlegroups.com.