cancel

package
v0.0.0-...-cff5d44 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWithTimeout

func NewWithTimeout(ctx context.Context, d time.Duration, f TimeoutedFunc) error

NewWithTimeout creates a new context with a timeout and runs the given function with the context. It returns an error if the function returns an error or if the context times out.

func Wait

func Wait(ctx context.Context, ch chan error) error

Wait waits for the context to be done.

Types

type TimeoutedFunc

type TimeoutedFunc func(ctx context.Context) error

TimeoutedFunc is a function that takes a context and returns an error. It is used to run a function with a timeout.

type WaitFunc

type WaitFunc func() error

WaitFunc is a function that waits for the context to be done. It is used to wait for the context to be done before returning.

func New

New creates a new context with a timeout and returns a channel to send the result and a function to cancel the context. It also returns a function that waits for the context to be done before returning.

Jump to

Keyboard shortcuts

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