Commit d6963bdf authored by Kirill Smelkov's avatar Kirill Smelkov

tracing/tracetest: Goodbye fatalLogMu

-> Reuse T.mu for serialization.

closeStreamTab changes locking so that acquired t.mu covers whole time
when that function could log anything.
parent 71b9f3fd
...@@ -289,9 +289,9 @@ func (t *T) closeStreamTab() (nnak int) { ...@@ -289,9 +289,9 @@ func (t *T) closeStreamTab() (nnak int) {
// mark streamTab no longer operational // mark streamTab no longer operational
t.mu.Lock() t.mu.Lock()
defer t.mu.Unlock()
streamTab := t.streamTab streamTab := t.streamTab
t.streamTab = nil t.streamTab = nil
t.mu.Unlock()
if streamTab == nil { if streamTab == nil {
return // already closed return // already closed
...@@ -501,14 +501,13 @@ func (t *T) expect1(stream string, eventExpect interface{}) *_Msg { ...@@ -501,14 +501,13 @@ func (t *T) expect1(stream string, eventExpect interface{}) *_Msg {
// //
// we don't panic because it will stop the process and prevent the main // we don't panic because it will stop the process and prevent the main
// goroutine to print detailed reason for e.g. deadlock or other error. // goroutine to print detailed reason for e.g. deadlock or other error.
var fatalLogMu sync.Mutex
func (t *T) fatalfInNonMain(format string, argv ...interface{}) { func (t *T) fatalfInNonMain(format string, argv ...interface{}) {
t.Helper() t.Helper()
// serialize fatal log+traceback printout, so that such printouts from // serialize fatal log+traceback printout, so that such printouts from
// multiple goroutines do not get intermixed. // multiple goroutines do not get intermixed.
fatalLogMu.Lock() t.mu.Lock()
defer fatalLogMu.Unlock() defer t.mu.Unlock()
t.Logf(format, argv...) t.Logf(format, argv...)
t.Logf("%s\n", debug.Stack()) t.Logf("%s\n", debug.Stack())
......
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