| 183 | } |
| 184 | |
| 185 | bool BaseWorker::Stop(bool flush_cancel) |
| 186 | { |
| 187 | if (m_state == Worker_Invalid || m_state == Worker_Stopped) |
| 188 | { |
| 189 | return false; |
| 190 | } |
| 191 | |
| 192 | if (m_state == Worker_Paused) |
| 193 | { |
| 194 | if (!Unpause()) |
| 195 | { |
| 196 | return false; |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | m_state = Worker_Stopped; |
| 201 | Flush(flush_cancel); |
| 202 | |
| 203 | if (m_pHooks) |
| 204 | { |
| 205 | m_pHooks->OnWorkerStop(this); |
| 206 | } |
| 207 | |
| 208 | return true; |
| 209 | } |
| 210 | |
| 211 | bool BaseWorker::Pause() |
| 212 | { |
no test coverage detected