arch/: Update all _exit() implementations for all architectures so that they correctly called the scheduler instumentation layer for the new task that runs when the old one exits. This missing instrumentation was confusing the Critical Section Monitor logic with uses this instrumentation to track the state of critical sections.
This commit is contained in:
parent
095b597d34
commit
0af39e1493
@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 201-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 201-2014, 2017-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -145,7 +146,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -153,13 +154,17 @@ void _exit(int status)
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
sinfo("Other tasks:\n");
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -180,6 +185,10 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(tcb->xcp.regs);
|
||||
|
@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* arch/avr/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2010, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010, 2013-2014, 2017-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -144,7 +145,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -152,13 +153,17 @@ void _exit(int status)
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
sinfo("Other tasks:\n");
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -179,6 +184,10 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(tcb->xcp.regs);
|
||||
|
@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* arch/hc/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2011, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2013-2014, 2017-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -144,7 +145,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
struct tcb_s* tcb;
|
||||
struct tcb_s* tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -152,13 +153,17 @@ void _exit(int status)
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
sinfo("Other tasks:\n");
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -179,6 +184,10 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(tcb->xcp.regs);
|
||||
|
@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* arch/mips/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2011, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2013-2014, 2017-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -146,7 +147,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -154,13 +155,17 @@ void _exit(int status)
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
sinfo("Other tasks:\n");
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -181,6 +186,10 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(tcb->xcp.regs);
|
||||
|
@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* arch/misoc/src/lm32/lm32_exit.c
|
||||
*
|
||||
* Copyright (C) 2010, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2010, 2013-2014, 2017-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Ramtin Amin <keytwo@gmail.com>
|
||||
*
|
||||
@ -56,10 +57,6 @@
|
||||
#include "group/group.h"
|
||||
#include "lm32.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
@ -143,7 +140,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -151,13 +148,17 @@ void _exit(int status)
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
sinfo("Other tasks:\n");
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -178,6 +179,10 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(tcb->xcp.regs);
|
||||
|
@ -145,7 +145,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -153,13 +153,17 @@ void _exit(int status)
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
sinfo("Other tasks:\n");
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -180,6 +184,10 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(tcb->xcp.regs);
|
||||
|
@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* arch/renesas/src/=common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2013-2014, 2017-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -144,7 +145,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
struct tcb_s* tcb;
|
||||
struct tcb_s* tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -152,13 +153,17 @@ void _exit(int status)
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
sinfo("Other tasks:\n");
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -179,7 +184,11 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Then switch contexts */
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(tcb->xcp.regs);
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* arch/risc-v/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2011, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2013-2014, 2017-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -146,7 +147,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -154,13 +155,17 @@ void _exit(int status)
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
sinfo("Other tasks:\n");
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -181,6 +186,10 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(tcb->xcp.regs);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/sim/src/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -65,10 +65,14 @@
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
FAR struct tcb_s *tcb;
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -80,6 +84,10 @@ void _exit(int status)
|
||||
tcb = this_task();
|
||||
sinfo("New Active Task TCB=%p\n", tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_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.
|
||||
|
@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2011, 2013-2014, 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2013-2014, 2016-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -144,7 +145,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
struct tcb_s* tcb;
|
||||
struct tcb_s* tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -152,13 +153,17 @@ void _exit(int status)
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
sinfo("Other tasks:\n");
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -179,6 +184,10 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
up_fullcontextrestore(tcb->xcp.regs);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/xtensa/src/common/xtensa_exit.c
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2016-2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -146,7 +146,7 @@ static void _xtensa_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
struct tcb_s *tcb;
|
||||
struct tcb_s *tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -154,17 +154,20 @@ void _exit(int status)
|
||||
|
||||
(void)enter_critical_section();
|
||||
|
||||
sinfo("TCB=%p exiting\n", this_task());
|
||||
sinfo("TCB=%p exiting\n", tcb);
|
||||
|
||||
#ifdef CONFIG_DUMP_ON_EXIT
|
||||
sinfo("Other tasks:\n");
|
||||
sched_foreach(_xtensa_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
#if XCHAL_CP_NUM > 0
|
||||
/* Disable co-processor support for the task that is exit-ing. */
|
||||
|
||||
tcb = this_task();
|
||||
xtensa_coproc_disable(&tcb->xcp.cpstate, XTENSA_CP_ALLSET);
|
||||
#endif
|
||||
|
||||
@ -194,6 +197,10 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
xtensa_context_restore(tcb->xcp.regs);
|
||||
|
@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* arch/z16/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2008-2009, 2013, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009, 2013, 2017-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -144,7 +145,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
FAR struct tcb_s* tcb;
|
||||
FAR struct tcb_s* tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -159,6 +160,10 @@ void _exit(int status)
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -170,6 +175,10 @@ void _exit(int status)
|
||||
tcb = this_task();
|
||||
sinfo("New Active Task TCB=%p\n", tcb);
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
RESTORE_USERCONTEXT(tcb);
|
||||
|
@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* arch/z80/src/common/up_exit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2013-2014, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2013-2014, 2017-2018 Gregory Nutt. All rights
|
||||
* reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -146,7 +147,7 @@ static void _up_dumponexit(FAR struct tcb_s *tcb, FAR void *arg)
|
||||
|
||||
void _exit(int status)
|
||||
{
|
||||
FAR struct tcb_s* tcb;
|
||||
FAR struct tcb_s* tcb = this_task();
|
||||
|
||||
/* Make sure that we are in a critical section with local interrupts.
|
||||
* The IRQ state will be restored when the next task is started.
|
||||
@ -161,6 +162,10 @@ void _exit(int status)
|
||||
sched_foreach(_up_dumponexit, NULL);
|
||||
#endif
|
||||
|
||||
/* Update scheduler parameters */
|
||||
|
||||
sched_suspend_scheduler(tcb);
|
||||
|
||||
/* Destroy the task at the head of the ready to run list. */
|
||||
|
||||
(void)task_exit();
|
||||
@ -182,6 +187,10 @@ void _exit(int status)
|
||||
(void)group_addrenv(tcb);
|
||||
#endif
|
||||
|
||||
/* Reset scheduler parameters */
|
||||
|
||||
sched_resume_scheduler(tcb);
|
||||
|
||||
/* Then switch contexts */
|
||||
|
||||
RESTORE_USERCONTEXT(tcb);
|
||||
|
Loading…
Reference in New Issue
Block a user