| 45 | } |
| 46 | |
| 47 | func newDtleTaskHandle(ctx context.Context, logger g.LoggerType, cfg *drivers.TaskConfig, state drivers.TaskState, started time.Time) *taskHandle { |
| 48 | h := &taskHandle{ |
| 49 | logger: logger, |
| 50 | stateLock: sync.RWMutex{}, |
| 51 | taskConfig: cfg, |
| 52 | procState: state, |
| 53 | startedAt: started, |
| 54 | completedAt: time.Time{}, |
| 55 | exitResult: nil, |
| 56 | waitCh: make(chan *drivers.ExitResult), |
| 57 | } |
| 58 | h.ctx, h.cancelFunc = context.WithCancel(ctx) |
| 59 | go h.watchWaitCh() |
| 60 | return h |
| 61 | } |
| 62 | |
| 63 | func (h *taskHandle) watchWaitCh() { |
| 64 | select { |