add ruleguard support, fix all the reported issues (#10335)

This commit is contained in:
Harshavardhana
2020-08-24 12:11:20 -07:00
committed by GitHub
parent bc2ebe0021
commit caad314faa
46 changed files with 803 additions and 128 deletions

View File

@@ -46,7 +46,7 @@ func NewLRWMutex() *LRWMutex {
func (lm *LRWMutex) Lock() {
const isWriteLock = true
lm.lockLoop(context.Background(), lm.id, lm.source, time.Duration(math.MaxInt64), isWriteLock)
lm.lockLoop(context.Background(), lm.id, lm.source, math.MaxInt64, isWriteLock)
}
// GetLock tries to get a write lock on lm before the timeout occurs.
@@ -63,7 +63,7 @@ func (lm *LRWMutex) GetLock(ctx context.Context, id string, source string, timeo
func (lm *LRWMutex) RLock() {
const isWriteLock = false
lm.lockLoop(context.Background(), lm.id, lm.source, time.Duration(1<<63-1), isWriteLock)
lm.lockLoop(context.Background(), lm.id, lm.source, 1<<63-1, isWriteLock)
}
// GetRLock tries to get a read lock on lm before the timeout occurs.