walnux/sched/semaphore
Jukka Laitinen 3e29996d97 sched: After nxsched_add_readytorun, change first parameter to up_switch_context to this_task()
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>
2025-08-20 10:16:43 +08:00
..
CMakeLists.txt cmake:refine nuttx cmake build system fix CMake build missing part 2024-10-13 02:25:06 +08:00
Make.defs sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
sem_clockwait.c sem: use wd_start_realtime/abstime to replace wd_start 2024-10-09 13:54:29 +08:00
sem_destroy.c Integrate nxmutex support fully into nxsem 2025-05-08 16:00:05 +08:00
sem_holder.c sched: unify Private Types banners 2025-05-28 10:17:15 +08:00
sem_initialize.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
sem_post.c sched: After nxsched_add_readytorun, change first parameter to up_switch_context to this_task() 2025-08-20 10:16:43 +08:00
sem_protect.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
sem_recover.c Integrate nxmutex support fully into nxsem 2025-05-08 16:00:05 +08:00
sem_reset.c Integrate nxmutex support fully into nxsem 2025-05-08 16:00:05 +08:00
sem_rw.c Revert "shced:sem: replace mutex with spinlock" 2024-10-29 23:01:39 +08:00
sem_setprotocol.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
sem_tickwait.c clock: Add clock_delay2abstick. 2025-05-12 19:56:29 +08:00
sem_timedwait.c sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
sem_timeout.c sched: change xx_timeout param from pid to tcb 2024-09-29 18:18:01 +08:00
sem_trywait.c Integrate nxmutex support fully into nxsem 2025-05-08 16:00:05 +08:00
sem_wait.c Integrate nxmutex support fully into nxsem 2025-05-08 16:00:05 +08:00
sem_waitirq.c sched: After nxsched_add_readytorun, change first parameter to up_switch_context to this_task() 2025-08-20 10:16:43 +08:00
semaphore.h libc/semaphore: Move fast mutex wait/post paths to libc 2025-04-01 20:37:23 +08:00