context

package
v0.0.0-...-fb9d71b Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 3 Imported by: 3

Documentation

Overview

Package context contains helper utilities regarding go contexts.

Index

Constants

This section is empty.

Variables

View Source
var TerminatesQuicklyTimeout = 20 * time.Millisecond

TerminatesQuicklyTimeout is the timeout that TerminatesQuickly uses.

Functions

func IsContextError

func IsContextError(err error) bool

IsContextError returns whether the given error originates from a context that was cancelled or whose deadline exceeded. Prior to checking, the error is unwrapped by calling errors.Cause.

func IsDone

func IsDone(ctx interface{ Done() <-chan struct{} }) bool

IsDone returns whether ctx is done.

func Terminates

func Terminates(timeout time.Duration, fn func()) bool

Terminates checks whether a function terminates within a certain timeout.

func TerminatesCtx

func TerminatesCtx(ctx context.Context, fn func()) bool

TerminatesCtx checks whether a function terminates before a context is done.

func TerminatesQuickly

func TerminatesQuickly(fn func()) bool

TerminatesQuickly checks whether a function terminates within 20 ms.

Types

This section is empty.

Directories

Path Synopsis
Package test tests the helper utilities regarding go contexts.
Package test tests the helper utilities regarding go contexts.

Jump to

Keyboard shortcuts

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