cancel

package
v4.20.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWrappedContext added in v4.0.2

func NewWrappedContext(left, right context.Context) context.Context

NewWrappedContext returns a Context that will be cancelled when either of the passed contexts are cancelled

Types

type Context

type Context interface {
	context.Context
	Wrap(context.Context) context.Context
	Cancel()
}

func New

func New(ctx context.Context) Context

New creates a context that wraps the given context and returns an obj that can be cancelled. This allows an object which desires to cancel a long running operation to store a single cancel.Context in it's struct variables instead of having to store both the context.Context and context.CancelFunc.

type WrappedContext added in v4.0.2

type WrappedContext struct {
	context.Context
	// contains filtered or unexported fields
}

func (*WrappedContext) Done added in v4.0.2

func (w *WrappedContext) Done() <-chan struct{}

func (*WrappedContext) Err added in v4.0.2

func (w *WrappedContext) Err() error

func (*WrappedContext) Reason added in v4.0.2

func (w *WrappedContext) Reason(err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL