That also means anyone else can call Lock() and Unlock() on your type. This is 
often not what you want, unless your type *is* a kind of lock (as opposed to 
*uses* a lock).

On 18 May 2018, at 23:45, matthewju...@gmail.com<mailto:matthewju...@gmail.com> 
wrote:

By embedding I meant this:

type ServiceQProperties struct {
    ...
    sync.Mutex
}

which allows you to call p.Lock() instead of p.REMutex.Lock(). It’s just a 
personal preference that I was happy about when I learned about it.


-- 
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.

Reply via email to