INNER CODE UNIT · Go
newTask
rwynn/gtm · gtm.go:33
func newTask(stopC chan bool) *task {
ctx, cancel := context.WithCancel(context.Background())
t := &task{
stopC: stopC,
doneC: make(chan bool),
ctx: ctx,
cancel: cancel,
}
go t.start()
return t
}
func (t *task) start() {
defer t.cancel()
select {
case <-t.doneC:
break
case <-t.stopC: