mirror of
https://github.com/apache/nuttx.git
synced 2025-12-06 09:01:15 +08:00
Change every occurence of up_switch_context to use this_task() as the first parameter. "nxsched_add_readytorun" returns "true" if context switch is required. "nxsched_add_readytorun" typically could only switch the assigned/running task to the one which is passed in as parameter. But this is not strictly guaranteed in SMP; if other CPUs tweak with affinities or priorities, it may be possible that the running task after the call is changed, but is some other task from the readytorun list (and it should be, if there is higher priority one available or the affinity of the added task prevents it to be scheduled in, but the previous head of the readytorun list should run. this_task() is always the correct one to switch to, since it always points to the tcb which was just switched in by the nxsched_add_readytorun. This is also a precursor to re-writing the SMP queue logic to remove pending lists for SMP. Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>