MCPcopy Index your code
hub / github.com/coder/coder / trackCommandGoroutine

Method trackCommandGoroutine

agent/agentscripts/agentscripts.go:469–481  ·  view source on GitHub ↗
(fn func())

Source from the content-addressed store, hash-verified

467}
468
469func (r *Runner) trackCommandGoroutine(fn func()) error {
470 r.closeMutex.Lock()
471 defer r.closeMutex.Unlock()
472 if r.isClosed() {
473 return xerrors.New("track command goroutine: closed")
474 }
475 r.cmdCloseWait.Add(1)
476 go func() {
477 defer r.cmdCloseWait.Done()
478 fn()
479 }()
480 return nil
481}
482
483func (r *Runner) isClosed() bool {
484 select {

Callers 2

StartCronMethod · 0.95
runMethod · 0.95

Calls 6

isClosedMethod · 0.95
NewMethod · 0.65
AddMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45
DoneMethod · 0.45

Tested by

no test coverage detected