sched: remove redundant variables "switched"

test:
We can use qemu for testing.

compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2023-12-26 14:56:48 +08:00 committed by Xiang Xiao
parent 1ee279c292
commit e067f897c0

View File

@ -153,7 +153,6 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
{ {
FAR struct tcb_s *rtcb; FAR struct tcb_s *rtcb;
FAR dq_queue_t *tasklist; FAR dq_queue_t *tasklist;
bool switched;
bool doswitch; bool doswitch;
int task_state; int task_state;
int cpu; int cpu;
@ -249,14 +248,14 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
*/ */
tasklist = list_assignedtasks(cpu); tasklist = list_assignedtasks(cpu);
switched = nxsched_add_prioritized(btcb, tasklist); doswitch = nxsched_add_prioritized(btcb, tasklist);
/* If the selected task list was the g_assignedtasks[] list and if the /* If the selected task list was the g_assignedtasks[] list and if the
* new tasks is the highest priority (RUNNING) task, then a context * new tasks is the highest priority (RUNNING) task, then a context
* switch will occur. * switch will occur.
*/ */
if (switched) if (doswitch)
{ {
FAR struct tcb_s *next; FAR struct tcb_s *next;
@ -332,8 +331,6 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
nxsched_add_prioritized(next, tasklist); nxsched_add_prioritized(next, tasklist);
} }
doswitch = true;
} }
else else
{ {