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.
()
| 54 | // and use of TryLock is often a sign of a deeper problem |
| 55 | // in a particular use of mutexes. |
| 56 | func (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. |
| 64 | func (m *LoggingMutex) getName() string { |