Another way to state this for those who might still be confused, if we list all possible results of a yield, making a list of every logically possible but exclusive possibility they would be:
- We could continue with the task making the call
- We could switch to a Higher Priority task
- We could switch to a Equal Priority task
- We could switch to a Lower Priority task.
It is easy to see that this list is exhaustive and exclusive (it covers every conceivable case, and no cases overlap).
By the rules of the scheduler, case 4 is impossible, and the first sentence is basically saying that if we ignored the current task, and the highest priority remaining task is lower in priority than the current task, we will use case 1 instead of case 4.
The second clause is telling us that case 2 is only possible if configUSE_PREEMPTION is 0 (or we aren’t following the rules in our ISRs), as if configUSE_PREEMPTION is true, then when that higher priority task became ready, we would have switched to it then, so the mere fact that we are running to call yield would be evidence that no higher priority task is ready to run.
There are a few small holes in this, one it is possible for an ISR to have been written, arguably incorrectly, to have made ready that higher priority task and then failed to activate the scheduler to run it, at which point its resumption would get delayed to the next time the scheduler is invoked, like a yield call. Another case would be if during the execution of the yield call, an interrupt occurs that causes a higher priority task to run. While technically true that the switch wasn’t BECAUSE of the call to yield, it did happen with the yield so might appear to a somewhat casual observer to have happened.
That all is a mouthful to say, so it makes sense to not go into that sort of detail, but I believe the sentence is there to help point out that if configUSE_PREEMPTION is true, you don’t need to use a yield to run the higher priority task that became ready, but if configUSE_PREEMPTION is 0, then it IS perhaps needed to put in calls to taskYEILD() to switch to the higher priority task if the code spends a significant period of time doing something that didn’t provide scheduler opportunities.