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/128ae959-8c71-431a-8960-fbdd57ad73dbn%40googlegroups.com.

Reply via email to