use RWMutex

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
pull/1186/head
Weizhen Wang 2022-03-18 15:55:34 +08:00 committed by Boyan Soubachov
parent a409ccf19e
commit 106ec21d14
1 changed files with 3 additions and 3 deletions

View File

@ -22,15 +22,15 @@ var matchMethod = flag.String("testify.m", "", "regular expression to select tes
// retrieving the current *testing.T context.
type Suite struct {
*assert.Assertions
mu sync.Mutex
mu sync.RWMutex
require *require.Assertions
t *testing.T
}
// T retrieves the current *testing.T context.
func (suite *Suite) T() *testing.T {
suite.mu.Lock()
defer suite.mu.Unlock()
suite.mu.RLock()
defer suite.mu.RUnlock()
return suite.t
}