Why sync.Once uses a sync.Mutex in addition to atomic functions? What are the drawbacks/shortcomings/deficiencies of this implementation?
type Once struct { done uint32 } func (o *Once) Do(f func()) { if !atomic.CompareAndSwapUint32(&o.done, 0, 1) { return } f() } -- 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.