diff --git a/arch/arm/src/common/arm_exit.c b/arch/arm/src/common/arm_exit.c index 261f2aa851..1941387b75 100644 --- a/arch/arm/src/common/arm_exit.c +++ b/arch/arm/src/common/arm_exit.c @@ -141,10 +141,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -165,10 +161,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ arm_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/avr/src/common/up_exit.c b/arch/avr/src/common/up_exit.c index ef91c8b197..051b7fd53a 100644 --- a/arch/avr/src/common/up_exit.c +++ b/arch/avr/src/common/up_exit.c @@ -156,10 +156,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -180,10 +176,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ up_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/hc/src/common/up_exit.c b/arch/hc/src/common/up_exit.c index 6795b5b9bf..cb2be42415 100644 --- a/arch/hc/src/common/up_exit.c +++ b/arch/hc/src/common/up_exit.c @@ -140,10 +140,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -164,10 +160,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ up_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/mips/src/common/mips_exit.c b/arch/mips/src/common/mips_exit.c index ec5c0e112b..fd85164864 100644 --- a/arch/mips/src/common/mips_exit.c +++ b/arch/mips/src/common/mips_exit.c @@ -158,10 +158,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -182,10 +178,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ up_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/misoc/src/lm32/lm32_exit.c b/arch/misoc/src/lm32/lm32_exit.c index 93a9e9f3c0..8c6f7d8a0e 100644 --- a/arch/misoc/src/lm32/lm32_exit.c +++ b/arch/misoc/src/lm32/lm32_exit.c @@ -151,10 +151,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -175,10 +171,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ up_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/misoc/src/minerva/minerva_exit.c b/arch/misoc/src/minerva/minerva_exit.c index 9ab3840d32..61e44998d8 100644 --- a/arch/misoc/src/minerva/minerva_exit.c +++ b/arch/misoc/src/minerva/minerva_exit.c @@ -149,10 +149,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -173,10 +169,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ up_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/or1k/src/common/up_exit.c b/arch/or1k/src/common/up_exit.c index fd2cd7a726..f37a940666 100644 --- a/arch/or1k/src/common/up_exit.c +++ b/arch/or1k/src/common/up_exit.c @@ -156,10 +156,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -180,10 +176,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ up_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/renesas/src/common/up_exit.c b/arch/renesas/src/common/up_exit.c index 7e98ec51ce..03d5459b5b 100644 --- a/arch/renesas/src/common/up_exit.c +++ b/arch/renesas/src/common/up_exit.c @@ -140,10 +140,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -164,10 +160,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ up_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/risc-v/src/common/riscv_exit.c b/arch/risc-v/src/common/riscv_exit.c index 94b13b56b8..051558ef53 100644 --- a/arch/risc-v/src/common/riscv_exit.c +++ b/arch/risc-v/src/common/riscv_exit.c @@ -158,10 +158,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -182,10 +178,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ up_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/sim/src/sim/up_exit.c b/arch/sim/src/sim/up_exit.c index 3e9b2b3083..af83470e01 100644 --- a/arch/sim/src/sim/up_exit.c +++ b/arch/sim/src/sim/up_exit.c @@ -69,10 +69,6 @@ void _exit(int status) sinfo("TCB=%p exiting\n", tcb); - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -84,10 +80,6 @@ void _exit(int status) tcb = this_task(); sinfo("New Active Task TCB=%p\n", tcb); - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* The way that we handle signals in the simulation is kind of * a kludge. This would be unsafe in a truly multi-threaded, interrupt * driven environment. diff --git a/arch/x86/src/common/up_exit.c b/arch/x86/src/common/up_exit.c index 2a3ef1920d..95533a2670 100644 --- a/arch/x86/src/common/up_exit.c +++ b/arch/x86/src/common/up_exit.c @@ -140,10 +140,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -164,10 +160,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ up_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/x86_64/src/common/up_exit.c b/arch/x86_64/src/common/up_exit.c index eec9a641db..cd55324775 100644 --- a/arch/x86_64/src/common/up_exit.c +++ b/arch/x86_64/src/common/up_exit.c @@ -135,7 +135,7 @@ void _exit(int status) * The IRQ state will be restored when the next task is started. */ - (void)enter_critical_section(); + enter_critical_section(); sinfo("TCB=%p exiting\n", this_task()); @@ -146,7 +146,7 @@ void _exit(int status) /* Destroy the task at the head of the ready to run list. */ - (void)nxtask_exit(); + nxtask_exit(); /* Now, perform the context switch to the new ready-to-run task at the * head of the list. @@ -165,11 +165,10 @@ void _exit(int status) * the ready-to-run list. */ - (void)group_addrenv(tcb); + group_addrenv(tcb); #endif /* Then switch contexts */ up_fullcontextrestore(tcb->xcp.regs); } - diff --git a/arch/xtensa/src/common/xtensa_exit.c b/arch/xtensa/src/common/xtensa_exit.c index 6c465ae1b9..95ab3d5a15 100644 --- a/arch/xtensa/src/common/xtensa_exit.c +++ b/arch/xtensa/src/common/xtensa_exit.c @@ -157,10 +157,6 @@ void _exit(int status) nxsched_foreach(_xtensa_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - #if XCHAL_CP_NUM > 0 /* Disable co-processor support for the task that is exit-ing. */ @@ -193,10 +189,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ xtensa_context_restore(tcb->xcp.regs); diff --git a/arch/z16/src/common/z16_exit.c b/arch/z16/src/common/z16_exit.c index d979cdf8d8..6a7fc47601 100644 --- a/arch/z16/src/common/z16_exit.c +++ b/arch/z16/src/common/z16_exit.c @@ -140,10 +140,6 @@ void _exit(int status) nxsched_foreach(_z16_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -155,10 +151,6 @@ void _exit(int status) tcb = this_task(); sinfo("New Active Task TCB=%p\n", tcb); - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ RESTORE_USERCONTEXT(tcb); diff --git a/arch/z80/src/common/z80_exit.c b/arch/z80/src/common/z80_exit.c index 51bf0a9f14..29f888768b 100644 --- a/arch/z80/src/common/z80_exit.c +++ b/arch/z80/src/common/z80_exit.c @@ -142,10 +142,6 @@ void _exit(int status) nxsched_foreach(_up_dumponexit, NULL); #endif - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(tcb); - /* Destroy the task at the head of the ready to run list. */ nxtask_exit(); @@ -167,10 +163,6 @@ void _exit(int status) group_addrenv(tcb); #endif - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(tcb); - /* Then switch contexts */ RESTORE_USERCONTEXT(tcb); diff --git a/sched/task/task_exit.c b/sched/task/task_exit.c index 72dd1ea9e3..831cb3a109 100644 --- a/sched/task/task_exit.c +++ b/sched/task/task_exit.c @@ -84,6 +84,10 @@ int nxtask_exit(void) dtcb = this_task(); #endif + /* Update scheduler parameters */ + + nxsched_suspend_scheduler(dtcb); + /* Remove the TCB of the current task from the ready-to-run list. A * context switch will definitely be necessary -- that must be done * by the architecture-specific logic. @@ -102,13 +106,11 @@ int nxtask_exit(void) rtcb = this_task(); #endif -#ifdef CONFIG_SMP /* Because clearing the global IRQ control in nxsched_remove_readytorun() * was moved to nxsched_resume_scheduler(). So call the API here. */ nxsched_resume_scheduler(rtcb); -#endif /* We are now in a bad state -- the head of the ready to run task list * does not correspond to the thread that is running. Disabling pre-