github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/util/syncutil/mutex_deadlock.go (about) 1 // Copyright 2016 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 // +build deadlock 12 13 package syncutil 14 15 import ( 16 "time" 17 18 deadlock "github.com/sasha-s/go-deadlock" 19 ) 20 21 func init() { 22 deadlock.Opts.DeadlockTimeout = 5 * time.Minute 23 } 24 25 // A Mutex is a mutual exclusion lock. 26 type Mutex struct { 27 deadlock.Mutex 28 } 29 30 // AssertHeld is a no-op for deadlock mutexes. 31 func (m *Mutex) AssertHeld() { 32 } 33 34 // An RWMutex is a reader/writer mutual exclusion lock. 35 type RWMutex struct { 36 deadlock.RWMutex 37 } 38 39 // AssertHeld is a no-op for deadlock mutexes. 40 func (rw *RWMutex) AssertHeld() { 41 } 42 43 // AssertRHeld is a no-op for deadlock mutexes. 44 func (rw *RWMutex) AssertRHeld() { 45 }