# README
task
sync wait group with cancel context
Install
go get -u github.com/dstgo/task
Usage
with cancel
ctx := context.Background()
t, cancel := task.New(ctx)
defer cancel(nil)
t.Add(task.NewWorker(func(ctx context.Context) error) {
for i := 0;;i++ {
fmt.Println("w",i*2+1)
}
return nil
}))
err := t.Run()
with timeout
ctx := context.Background()
t, cancel := task.WithTimeout(ctx, time.Second)
defer cancel(nil)
t.Add(task.WithTimeoutWorker(func (ctx context.Context) error) {
for i := 0;; i++ {
fmt.Println("w", i*2+1)
}
return nil
}, time.Millisecond))
err := t.Run()
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author