Hello,

In the Go standard library, in the file log/slog/handler.go, I found the 
following code:

func (h *commonHandler) clone() *commonHandler {
// We can't use assignment because we can't copy the mutex.
return &commonHandler{
json:              h.json,
opts:              h.opts,
preformattedAttrs: slices.Clip(h.preformattedAttrs),
groupPrefix:       h.groupPrefix,
groups:            slices.Clip(h.groups),
nOpenGroups:       h.nOpenGroups,
w:                 h.w,
mu:                h.mu, // mutex shared among all clones of this handler
}
}

The first comment states that "we can't copy the mutex", but then the last 
line seems to copy the mutex anyway.  What is going on here?

Maybe this just an oversight from a time when every hander had its own 
mutex?  Or is there something subtle going on here?

Many thanks,
Jochen

-- 
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/153e9898-f17e-44cc-ab2a-8570f916c0c3n%40googlegroups.com.

Reply via email to