chattarajoy / workgroup

Workgroup provides a mechanism for controlling the lifetime of a set of related goroutines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Heptio Workgroup

Maintainers: Heptio

Build Status

godoc

Overview

Workgroup is a small utility to manage the lifetime of a set of related goroutines.

Examples

http.Serve

var g workgroup.Group

g.Add(func(stop <-chan struct{}) error {
	l, err := net.Listen("tcp", ":80") // listen on port 80
        if err != nil {
                return err
        }

        go func() {
                <-stop // close listener on stop request
                l.Close()
        }()
        return http.Serve(l, mux)
})
g.Run()

Related work

workgroup.Group is heavily inspired by prior art including oklog's run.Group and Gustavo Niemeyer's tomb packages.

Contributing

Thanks for taking the time to join our community and start contributing!

Bug reports are most welcome, but with the exception of #5, this project is closed.

  • Please familiarize yourself with the Code of Conduct before contributing.
  • See CONTRIBUTING.md for information about setting up your environment, the workflow that we expect, and instructions on the developer certificate of origin that we require.

Changelog

See the list of releases to find out about feature changes.

About

Workgroup provides a mechanism for controlling the lifetime of a set of related goroutines

License:Apache License 2.0


Languages

Language:Go 92.4%Language:Makefile 7.6%