Unverified Commit 6c3fea0f authored by aaronbuchwald's avatar aaronbuchwald Committed by GitHub

log: modify lock defer unlock order in sync handler (#24667)

This modifies the order of Lock() defer Unlock() to follow the more
typically used pattern.
parent c1b69bd1
...@@ -52,8 +52,9 @@ func StreamHandler(wr io.Writer, fmtr Format) Handler { ...@@ -52,8 +52,9 @@ func StreamHandler(wr io.Writer, fmtr Format) Handler {
func SyncHandler(h Handler) Handler { func SyncHandler(h Handler) Handler {
var mu sync.Mutex var mu sync.Mutex
return FuncHandler(func(r *Record) error { return FuncHandler(func(r *Record) error {
defer mu.Unlock()
mu.Lock() mu.Lock()
defer mu.Unlock()
return h.Log(r) return h.Log(r)
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment