SMP: Reorder some logic related to task exit() and restart() for logic of SMP.

This commit is contained in:
Gregory Nutt
2016-03-22 18:19:57 -06:00
parent 2534791a2e
commit f0671bae2f
3 changed files with 44 additions and 44 deletions
+10 -16
View File
@@ -127,22 +127,7 @@ int task_exit(void)
ret = task_terminate(dtcb->pid, true);
rtcb->task_state = TSTATE_TASK_RUNNING;
/* If there are any pending tasks, then add them to the ready-to-run
* task list now
*/
if (g_pendingtasks.head != NULL)
{
(void)sched_mergepending();
}
/* We can't use sched_unlock() to decrement the lock count because the
* sched_mergepending() call above might have changed the task at the
* head of the ready-to-run list. Furthermore, we should not need to
* perform the unlock action anyway because we know that the pending
* task list is empty. So all we really need to do is to decrement
* the lockcount on rctb.
*/
/* Decrement the lockcount on rctb. */
rtcb->lockcount--;
@@ -156,5 +141,14 @@ int task_exit(void)
}
#endif
/* If there are any pending tasks, then add them to the ready-to-run
* task list now
*/
if (g_pendingtasks.head != NULL)
{
(void)sched_mergepending();
}
return ret;
}