setInProgressTo updates in progress state. If inProgress is set to false and sort was aborted this means someone is waiting. Therefore the function is waking up everyone who is waiting. PRECONDITION: `m.mu` must be locked.
(inProgress bool)
| 595 | // |
| 596 | // PRECONDITION: `m.mu` must be locked. |
| 597 | func (m *Manager) setInProgressTo(inProgress bool) { |
| 598 | // If marking as finished and job was aborted to need to free everyone |
| 599 | // who is waiting. |
| 600 | m.state.inProgress.Store(inProgress) |
| 601 | if !inProgress && m.aborted() { |
| 602 | m.state.wg.Done() |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | // setAbortedTo updates aborted state. If aborted is set to true and sort is not |
| 607 | // yet finished. We need to inform current phase about abort (closing channel) |