Documentation
¶
Overview ¶
Package sync provides a locker implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAlreadyLocked = errors.New("already locked")
ErrAlreadyLocked is returned when the lock is already locked.
Functions ¶
This section is empty.
Types ¶
type Locker ¶
type Locker interface { // Lock locks the mutex with a cancelable context Lock(ctx context.Context) error // TryLock locks the mutex if not already locked by another session. TryLock(ctx context.Context) error // Unlock unlocks the mutex. Unlock(ctx context.Context) error // RLock acquires a read lock with a cancelable context. RLock(ctx context.Context) error // RUnlock releases a read lock previously acquired by RLock. RUnlock(ctx context.Context) error }
A Locker represents an object that can be locked and unlocked.
type LockerManager ¶ added in v0.6.0
type LockerManager struct {
// contains filtered or unexported fields
}
LockerManager manages Lockers.
Click to show internal directories.
Click to hide internal directories.