MCPcopy
hub / github.com/dagger/container-use / WithLock

Method WithLock

repository/flock.go:125–132  ·  view source on GitHub ↗

WithLock executes a function while holding an exclusive lock.

(ctx context.Context, fn func() error)

Source from the content-addressed store, hash-verified

123
124// WithLock executes a function while holding an exclusive lock.
125func (rl *RepositoryLock) WithLock(ctx context.Context, fn func() error) error {
126 if err := rl.Lock(ctx); err != nil {
127 return err
128 }
129 defer rl.Unlock()
130
131 return fn()
132}
133
134// WithRLock executes a function while holding a shared lock.
135func (rl *RepositoryLock) WithRLock(ctx context.Context, fn func() error) error {

Callers 11

ensureForkMethod · 0.45
ensureUserRemoteMethod · 0.45
CreateMethod · 0.45
initializeWorktreeMethod · 0.45
getWorktreeMethod · 0.45
propagateToWorktreeMethod · 0.45
propagateGitNotesMethod · 0.45
saveStateMethod · 0.45
addGitNoteMethod · 0.45
commitWorktreeChangesMethod · 0.45
WithLockMethod · 0.45

Calls 2

LockMethod · 0.95
UnlockMethod · 0.95

Tested by

no test coverage detected