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

Tree @c30c7f1 (Download .tar.gz)

options_go1.7.go @c30c7f1raw · 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()
		}
	}
}