MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TryLock

Method TryLock

base/util_logging_mutex.go:56–61  ·  view source on GitHub ↗

TryLock tries to lock m and reports whether it succeeded. Note that while correct uses of TryLock do exist, they are rare, and use of TryLock is often a sign of a deeper problem in a particular use of mutexes.

()

Source from the content-addressed store, hash-verified

54// and use of TryLock is often a sign of a deeper problem
55// in a particular use of mutexes.
56func (m *LoggingMutex) TryLock() bool {
57 TracefCtx(m.ctx, KeyAll, "Before %s.TryLock() %s", m.getName(), GetCallersName(1, true))
58 result := m.Mutex.TryLock()
59 TracefCtx(m.ctx, KeyAll, "After %s.TryLock() %s", m.getName(), GetCallersName(1, true))
60 return result
61}
62
63// getName returns the name of the mutex for logging.
64func (m *LoggingMutex) getName() string {

Callers 2

TestLoggingMutexFunction · 0.95
TryLockMethod · 0.45

Calls 3

getNameMethod · 0.95
TracefCtxFunction · 0.85
GetCallersNameFunction · 0.85

Tested by 1

TestLoggingMutexFunction · 0.76