Documentation ¶
Index ¶
- type LRWMutex
- func (lm *LRWMutex) DRLocker() sync.Locker
- func (lm *LRWMutex) ForceUnlock()
- func (lm *LRWMutex) GetLock(ctx context.Context, id string, source string, timeout time.Duration) (locked bool)
- func (lm *LRWMutex) GetRLock(ctx context.Context, id string, source string, timeout time.Duration) (locked bool)
- func (lm *LRWMutex) Lock()
- func (lm *LRWMutex) RLock()
- func (lm *LRWMutex) RUnlock()
- func (lm *LRWMutex) Unlock()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LRWMutex ¶
type LRWMutex struct {
// contains filtered or unexported fields
}
A LRWMutex is a mutual exclusion lock with timeouts.
func (*LRWMutex) DRLocker ¶
DRLocker returns a sync.Locker interface that implements the Lock and Unlock methods by calling drw.RLock and drw.RUnlock.
func (*LRWMutex) ForceUnlock ¶
func (lm *LRWMutex) ForceUnlock()
ForceUnlock will forcefully clear a write or read lock.
func (*LRWMutex) GetLock ¶
func (lm *LRWMutex) GetLock(ctx context.Context, id string, source string, timeout time.Duration) (locked bool)
GetLock tries to get a write lock on lm before the timeout occurs.
func (*LRWMutex) GetRLock ¶
func (lm *LRWMutex) GetRLock(ctx context.Context, id string, source string, timeout time.Duration) (locked bool)
GetRLock tries to get a read lock on lm before the timeout occurs.
func (*LRWMutex) Lock ¶
func (lm *LRWMutex) Lock()
Lock holds a write lock on lm.
If the lock is already in use, the calling go routine blocks until the mutex is available.
func (*LRWMutex) RLock ¶
func (lm *LRWMutex) RLock()
RLock holds a read lock on lm.
If one or more read lock are already in use, it will grant another lock. Otherwise the calling go routine blocks until the mutex is available.