Codebase list golang-github-vbauerster-mpb / cf6bc3e options_go1.7.go
cf6bc3e

Tree @cf6bc3e (Download .tar.gz)

options_go1.7.go @cf6bc3eraw · history · blame

//+build go1.7

package mpb

import "context"

// WithContext provided context will be used for cancellation purposes
func WithContext(ctx context.Context) ProgressOption {
	return func(s *pState) {
		if ctx != nil {
			s.cancel = ctx.Done()
		}
	}
}