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

Function eitherContext

agent/agent.go:2382–2392  ·  view source on GitHub ↗

eitherContext returns a context that is canceled when either context ends.

(a, b context.Context)

Source from the content-addressed store, hash-verified

2380
2381// eitherContext returns a context that is canceled when either context ends.
2382func eitherContext(a, b context.Context) context.Context {
2383 ctx, cancel := context.WithCancel(a)
2384 go func() {
2385 defer cancel()
2386 select {
2387 case <-a.Done():
2388 case <-b.Done():
2389 }
2390 }()
2391 return ctx
2392}
2393
2394type gracefulShutdownBehavior int
2395

Callers 1

newAPIConnRoutineManagerFunction · 0.85

Calls 1

DoneMethod · 0.45

Tested by

no test coverage detected