task_delete() calls sched_unlock(); _exit must keep pre-emption disabled until pending queue emptied.

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@167 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2007-03-29 13:26:24 +00:00
parent 56f7399200
commit 0db3f5c256
4 changed files with 46 additions and 1 deletions

View File

@ -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.
*/

View File

@ -149,6 +149,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);
@ -163,6 +170,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.
*/

View File

@ -90,6 +90,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);
@ -104,6 +111,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.
*/

View File

@ -73,6 +73,7 @@
void _exit(int status)
{
_TCB* tcb = (_TCB*)g_readytorun.head;
irqstate_t flags;
dbg("TCB=%p exitting\n", tcb);
@ -83,13 +84,20 @@ 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);
task_delete(tcb->pid);
/* If there are any pending tasks, then add them to the g_readytorun
* task list now
* task list now.
*/
if (g_pendingtasks.head)
@ -97,6 +105,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.
*/