cancellablecontext

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package cancellablecontext is a wrapper around context.WithCancel that exposes context.CancelFunc as a receiver.

This is just a convenience package that makes passing a cancellable context to child services easier, as with this you only have to pass a CancellableContext to a child, rather than both a context.Context and a context.CancelFunc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API is a context that can broadcast cancellation.

func New

func New(parentCtx context.Context) *API

New returns a reference to a new CancellableContext.

func (*API) Cancel

func (c *API) Cancel()

Cancel calls the context.CancelFunc, initializing a cancellation of all listeners.

Directories

Path Synopsis
Package cancellablecontextiface represents a context that supports cancellation.
Package cancellablecontextiface represents a context that supports cancellation.

Jump to

Keyboard shortcuts

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