Files
cert-manager/pkg/util/context.go
T

18 lines
265 B
Go

package util
import (
"context"
)
func ContextWithStopCh(ctx context.Context, stopCh <-chan struct{}) context.Context {
ctx, cancel := context.WithCancel(ctx)
go func() {
defer cancel()
select {
case <-ctx.Done():
case <-stopCh:
}
}()
return ctx
}