saefullohmaslul / golang-concurrency

Example of concurrency code using golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example of Concurrency on Golang

Basic

On basic concurrency concept, we can running some function simultaneously. Golang can handle it by

go basicConcurrentFunc("get water")
basicConcurrentFunc("read book")

So that get water will run together with the read book

Group

On group concurrency concept, we can running some function paralel. Golang can handle it by

wg.Add(paralelProcess)

go paralelFunc(&wg, "function one")
go paralelFunc(&wg, "function two")
wg.Wait()

paralelFunc(nil, "function three")

So that function one and function two will running paralel. Then function three will execute after other function finished

About

Example of concurrency code using golang


Languages

Language:Go 100.0%