example1

command
v0.0.0-...-79b2278 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: MIT Imports: 4 Imported by: 0

README

Context

Package context defines the Context type, which carries deadlines, cancellation signals, and other request-scoped values across API boundaries and between processes.

In case you want to receive a context, you most likely want an select statement to orchestrate results generate by the function and any cancellation signal.

ctx := context.Background()
resultsCh := make(chan *WorkResult)

// ...

for {
	select {
	case <- ctx.Done():
		// The context is over, stop processing results
		return
	case result := <- resultsCh:
		// Process the results received
	}
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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