resourcecanceledcontext

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 1 Imported by: 31

Documentation

Overview

Package resourcecanceledcontext stores and accesses the canceled in context.Context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) (chan struct{}, bool)

FromContext returns the canceled channel, if any.

func IsCanceled

func IsCanceled(ctx context.Context) bool

IsCanceled checks whether the given context obtains information about the canceled channel as defined in this package, if any canceled channel is present.

NOTE that the canceled channel, if any found, is only used to be closed to signal cancelation. It is not guaranteed that the channel is buffered or read from. Clients must not write to it. Otherwise the canceled channel will block eventually. It is safe to signal cancelation via SetCanceled.

func NewContext

func NewContext(ctx context.Context, v chan struct{}) context.Context

NewContext returns a new context.Context that carries value v.

func SetCanceled

func SetCanceled(ctx context.Context)

SetCanceled is a safe way to signal cancelation.

Types

This section is empty.

Jump to

Keyboard shortcuts

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