summaryrefslogtreecommitdiff
path: root/nuttx/arch/c5471/src/up_exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/arch/c5471/src/up_exit.c')
-rw-r--r--nuttx/arch/c5471/src/up_exit.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/nuttx/arch/c5471/src/up_exit.c b/nuttx/arch/c5471/src/up_exit.c
index c6f544776..2ef47bdfb 100644
--- a/nuttx/arch/c5471/src/up_exit.c
+++ b/nuttx/arch/c5471/src/up_exit.c
@@ -145,6 +145,13 @@ void _exit(int status)
(void)sched_removereadytorun(tcb);
+ /* We are not in a bad stack-- the head of the ready to run task list
+ * does not correspond to the thread that is running. Disabling pre-
+ * emption on this TCB should be enough to keep things stable.
+ */
+
+ sched_lock();
+
/* Move the TCB to the specified blocked task list and delete it */
sched_addblocked(tcb, TSTATE_TASK_INACTIVE);
@@ -159,6 +166,10 @@ void _exit(int status)
(void)sched_mergepending();
}
+ /* Now calling sched_unlock() should have no effect */
+
+ sched_unlock();
+
/* Now, perform the context switch to the new ready-to-run task at the
* head of the list.
*/