packages/redux-saga/src/internal/proc.js
function cancel() {
    /**
      We need to check both Running and Cancelled status
      Tasks can be Cancelled but still Running
    **/
    if (iterator._isRunning && !iterator._isCancelled) {
      iterator._isCancelled = true
      taskQueue.cancelAll()
      /**
        Ending with a Never result will propagate the Cancellation to all joiners
      **/
      end(TASK_CANCEL)
    }
  }
function cancel() {
    /**
      We need to check both Running and Cancelled status
      Tasks can be Cancelled but still Running
    **/
    if (iterator._isRunning && !iterator._isCancelled) {
      iterator._isCancelled = true
      taskQueue.cancelAll()
      /**
        Ending with a Never result will propagate the Cancellation to all joiners
      **/
      end(TASK_CANCEL)
    }
  }
function cancel ( ) { /**
      We need to check both Running and Cancelled status
      Tasks can be Cancelled but still Running
    **/ if ( iterator . _isRunning && ! iterator . _isCancelled ) { iterator . _isCancelled = true taskQueue . cancelAll ( ) /**
        Ending with a Never result will propagate the Cancellation to all joiners
      **/ end ( TASK_CANCEL ) } }
This may be called by a parent generator to trigger/propagate cancellation
cancel all pending tasks (including the main task), then end the current task.

Cancellation propagates down to the whole execution tree holded by this Parent task
It's also propagated to all joiners of this task and their execution tree/joiners

Cancellation is noop for terminated/Cancelled tasks tasks
This may be called by a parent generator to trigger / propagate cancellation cancel all pending tasks ( including the main task ) then end the current task .