Documentation ¶
Overview ¶
Package lock wraps the sync.Mutex and sync.RWMutex to log messages on deadlocks.
Index ¶
Constants ¶
View Source
const ( OpMutexLock = "Mutex.Lock" OpRWMutexLock = "RWMutex.Lock" OpRWMutexRLock = "RWMutex.RLock" )
Constants of operations.
Variables ¶
View Source
var DefaultLogFunc = func(m MutexWrapper, op string) { l.Errorf( "Timeout! Wait %dms to acquire lock %s, blocked operation is %s, callers stack:\n%s", int(m.Timeout().Nanoseconds()/1000000), m.Name(), op, debug.Stack(), ) }
DefaultLogFunc Default log function
Functions ¶
Types ¶
type Mutex ¶
type Mutex struct {
// contains filtered or unexported fields
}
Mutex is the wrapper around sync.Mutex.
type MutexWrapper ¶
type MutexWrapper interface { // Name returns the name of this mutex wrapper. Name() string // Timeout returns the timeout value of this mutex wrapper. Timeout() time.Duration }
MutexWrapper is an interface implemented by Mutex and RWMutex.
Click to show internal directories.
Click to hide internal directories.