Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TryLocker ¶ added in v1.3.0
type TryLocker interface {
// TryLock acquires the write lock without blocking.
// On success, returns true. On failure or timeout, returns false.
// A negative timeout means no timeout.
// A zero timeout means try and return at once.
TryLock(timeout time.Duration) bool
// Lock locks for writing.
// If the lock is already locked for reading or writing, Lock blocks until the lock is available.
Lock()
// Unlock unlocks for writing.
// It is a panic if is not locked for writing before.
Unlock()
// RTryLock acquires the read lock without blocking.
// On success, returns true. On failure or timeout, returns false.
// A negative timeout means no timeout.
// A zero timeout means try and return at once.
RTryLock(timeout time.Duration) bool
// RLock locks for reading.
// If the lock is already locked for writing, RLock blocks until the lock is available.
RLock()
// RUnlock unlocks for reading.
// It is a panic if is not locked for reading before.
RUnlock()
}
TryLocker is a RWMutex with trylock support
Click to show internal directories.
Click to hide internal directories.