MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / Stop

Method Stop

server-source-code/internal/guacd/guacd.go:121–141  ·  view source on GitHub ↗

Stop stops the guacd process. It signals the process via context cancellation and waits for the existing wait() goroutine to finish, avoiding a double Wait race.

()

Source from the content-addressed store, hash-verified

119// Stop stops the guacd process. It signals the process via context cancellation
120// and waits for the existing wait() goroutine to finish, avoiding a double Wait race.
121func (p *Process) Stop() {
122 p.mu.Lock()
123 if p.cancel != nil {
124 p.cancel()
125 p.cancel = nil
126 }
127 p.mu.Unlock()
128
129 // Wait for the existing wait() goroutine to observe the exit.
130 select {
131 case <-p.done:
132 case <-time.After(3 * time.Second):
133 // Force kill if context cancellation wasn't enough.
134 p.mu.Lock()
135 if p.cmd != nil && p.cmd.Process != nil {
136 _ = p.cmd.Process.Kill()
137 }
138 p.mu.Unlock()
139 <-p.done
140 }
141}
142
143// Running returns true if guacd is still running.
144func (p *Process) Running() bool {

Callers 7

timeoutLoopMethod · 0.45
WaitReadyMethod · 0.45
pollMethod · 0.45
ProcessTaskMethod · 0.45
StartMemStatsFunction · 0.45
ServeRunStreamMethod · 0.45
mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected