Skip to content

Commit 08f9747

Browse files
committed
refactor
1 parent 9c53801 commit 08f9747

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

sync.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package sync
44

55
import (
66
"bytes"
7-
"fmt"
87
"github.com/funny/goid"
98
"runtime/pprof"
109
"strconv"
@@ -73,19 +72,21 @@ func (m *mointor) wait() int32 {
7372
func (m *mointor) verify(holder int32, holderLink []int32) {
7473
if m.holder != 0 {
7574
if m.holder == holder {
76-
buf := new(bytes.Buffer)
77-
fmt.Fprintln(buf, "[DEAD LOCK]\n")
78-
79-
// dump goroutines
75+
// dump stack
8076
stackBuf := new(bytes.Buffer)
8177
prof := pprof.Lookup("goroutine")
8278
prof.WriteTo(stackBuf, 2)
8379
stack := stackBuf.Bytes()
84-
fmt.Fprintf(buf, "%s\n\n", traceGoroutine(holder, stack))
80+
81+
// match goroutines
82+
buf := new(bytes.Buffer)
83+
buf.WriteString("[DEAD LOCK]\n")
84+
buf.Write(traceGoroutine(holder, stack))
85+
buf.Write(goroutineEnd)
8586
for i := 0; i < len(holderLink); i++ {
86-
fmt.Fprintf(buf, "%s\n\n", traceGoroutine(holderLink[i], stack))
87+
buf.Write(traceGoroutine(holderLink[i], stack))
88+
buf.Write(goroutineEnd)
8789
}
88-
8990
panic(buf.String())
9091
}
9192
if waitTarget, exists := waitTargets[m.holder]; exists {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy