diff options
Diffstat (limited to 'src/pkg/runtime/race/testdata/sync_test.go')
-rw-r--r-- | src/pkg/runtime/race/testdata/sync_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pkg/runtime/race/testdata/sync_test.go b/src/pkg/runtime/race/testdata/sync_test.go index e80ba3b74..93af0b1e6 100644 --- a/src/pkg/runtime/race/testdata/sync_test.go +++ b/src/pkg/runtime/race/testdata/sync_test.go @@ -195,3 +195,22 @@ func TestRaceGoroutineCreationStack(t *testing.T) { x = 2 <-ch } + +// A nil pointer in a mutex method call should not +// corrupt the race detector state. +// Used to hang indefinitely. +func TestNoRaceNilMutexCrash(t *testing.T) { + var mutex sync.Mutex + panics := 0 + defer func() { + if x := recover(); x != nil { + mutex.Lock() + panics++ + mutex.Unlock() + } else { + panic("no panic") + } + }() + var othermutex *sync.RWMutex + othermutex.RLock() +} |