Stop terminate running tasks and end the manager scheduling cycle.
()
| 93 | |
| 94 | // Stop terminate running tasks and end the manager scheduling cycle. |
| 95 | func (m *Manager) Stop() { |
| 96 | if m.cancel != nil { |
| 97 | m.cancel() |
| 98 | } |
| 99 | |
| 100 | m.wg.Wait() |
| 101 | |
| 102 | // cleanup |
| 103 | m.waitMap = make(map[int64][]*waitItem) |
| 104 | for _, t := range m.taskMap { |
| 105 | m.cleanupTask(t) |
| 106 | } |
| 107 | m.taskMap = make(map[int64]*taskItem) |
| 108 | |
| 109 | log.Debug("task manager stopped") |
| 110 | |
| 111 | return |
| 112 | } |
| 113 | |
| 114 | // Kill terminated specified task. |
| 115 | func (m *Manager) Kill(id int64) { |