WithLock executes a function while holding an exclusive lock for the specified lock type
(ctx context.Context, lockType LockType, fn func() error)
| 76 | |
| 77 | // WithLock executes a function while holding an exclusive lock for the specified lock type |
| 78 | func (rlm *RepositoryLockManager) WithLock(ctx context.Context, lockType LockType, fn func() error) error { |
| 79 | return rlm.GetLock(lockType).WithLock(ctx, fn) |
| 80 | } |
| 81 | |
| 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. |