diff --git a/terminatecontext.go b/terminatecontext.go index d71dd8d..92c7318 100644 --- a/terminatecontext.go +++ b/terminatecontext.go @@ -21,17 +21,14 @@ func (c *terminateContext) Terminate() { } // NewTerminateContext returns the underlying context as TerminateContext. -// It cancels the context when it was done through parent, deadline, timeout or in any way. // The code should call Terminate method or cancel function to release resources associated with it. func NewTerminateContext(ctx context.Context, cancel context.CancelFunc) TerminateContext { result := new(terminateContext) result.Context, result.CancelFunc = ctx, cancel - AutoCancel(ctx, cancel) return result } // WithTerminate creates a new cancel context as TerminateContext. -// It cancels the context when it was done through parent. // The code should call Terminate method to release resources associated with it, as cancel function. func WithTerminate(parent context.Context) TerminateContext { return NewTerminateContext(context.WithCancel(parent))