Skip to content

ConradIrwin/parallel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Package parallel is an implementation of structured concurrency for go. https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/

It is designed to help reason about parallel code by ensuring that go-routines are started and stopped in a strictly nested pattern: a child goroutine will never outlive its parent.

See https://pkg.go.dev/github.com/ConradIrwin/parallel for full documentation.

parallel.Do(func(p *parallel.P) {
    p.Go(doSomethingSlow)
    p.Go(doSomethingElse)
})

parallel.Each([]int{1,2,3}, func(i int) {
    time.Sleep(i * time.Second)
    fmt.Println(i)
})

About

Structured concurrency for go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages