Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TryLocker ¶
type TryLocker interface { // TryLock acquires the write lock without blocking. // On success, returns true. On failure or context cancellation, // returns false. // A nil Context means try and return at once. TryLock(context.Context) bool // TryLockTimeout 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. TryLockTimeout(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 nil Context means try and return at once. RTryLock(context.Context) bool // RTryLockTimeout 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. RTryLockTimeout(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.