* @brief Executor::cancelNext cancels execution of first process in queue * if it's not already running * * @return id of the cancelled process or -1 on error */
| 332 | * @return id of the cancelled process or -1 on error |
| 333 | */ |
| 334 | auto Executor::cancelNext() -> int { |
| 335 | if (running || m_execQueue.isEmpty()) { |
| 336 | return -1; // Return -1 to indicate no process was cancelled |
| 337 | // (queue empty or currently executing). |
| 338 | } |
| 339 | return m_execQueue.dequeue().id; |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * @brief Executor::finished called when an executed process finishes |