func()

in task.go [164:174]


func (t *Task[T]) finish(state State, result T, err error) {
	// only update state and result if not yet canceled
	t.mutex.Lock()
	defer t.mutex.Unlock()
	if !t.state.IsTerminalState() {
		t.cancelFunc() // cancel the context
		t.state = state
		t.result = result
		t.err = err
	}
}