goroutines-waitgroup

command
v0.0.0-...-a2a1f02 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 3 Imported by: 0

README

goroutines-waitgroup example

Concurrency using a waitgroup (waiting for a collection of goroutines to finish).

These are my 5 main example of using goroutines,

GitHub Webpage

WAITGROUP

A WaitGroup allows to wait for a collection of goroutines to finish.

First make a waitgroup,

var wg sync.WaitGroup
  • wg.Add(1) - Add the goroutines to the waitgroup
  • wg.Done() - Call done when goroutine finished
  • wg.Wait() - Wait for all the the waitgroups are done

IMAGE - goroutines-waitgroup - IMAGE

RUN

go run goroutines_waitgroup.go

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