WithRLock executes a function while holding a shared (read) lock for the specified lock type. Multiple readers can hold the lock simultaneously, but writers will block until all readers release.
(ctx context.Context, lockType LockType, fn func() error)
| 82 | // WithRLock executes a function while holding a shared (read) lock for the specified lock type. |
| 83 | // Multiple readers can hold the lock simultaneously, but writers will block until all readers release. |
| 84 | func (rlm *RepositoryLockManager) WithRLock(ctx context.Context, lockType LockType, fn func() error) error { |
| 85 | return rlm.GetLock(lockType).WithRLock(ctx, fn) |
| 86 | } |
| 87 | |
| 88 | // Lock acquires an exclusive repository lock. |
| 89 | func (rl *RepositoryLock) Lock(ctx context.Context) error { |