leave_critical_section: Fix text of whether spinlock should be released or not
This commit is contained in:
parent
d6912d0b00
commit
8ac12839c3
2
configs
2
configs
|
@ -1 +1 @@
|
||||||
Subproject commit ebc3a719168c1e7524a64498cd6d9312f26d36b0
|
Subproject commit ff5400544e8ab499fcf20a1a88ebec05c9cbd2e9
|
|
@ -181,22 +181,36 @@ void leave_critical_section(irqstate_t flags)
|
||||||
|
|
||||||
sched_note_csection(rtcb, false);
|
sched_note_csection(rtcb, false);
|
||||||
#endif
|
#endif
|
||||||
/* Release the spinlock to allow other access. */
|
/* Decrement our count on the lock. If all CPUs have released,
|
||||||
|
* then unlock the spinlock.
|
||||||
g_cpu_irqset &= ~(1 << this_cpu());
|
|
||||||
rtcb->irqcount = 0;
|
|
||||||
spin_unlock(g_cpu_irqlock);
|
|
||||||
|
|
||||||
/* Release any ready-to-run tasks that have collected in
|
|
||||||
* g_pendingtasks if the scheduler is not locked.
|
|
||||||
*
|
|
||||||
* NOTE: This operation has a very high likelihood of causing
|
|
||||||
* this task to be switched out!
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (g_pendingtasks.head != NULL && rtcb->lockcount <= 0)
|
rtcb->irqcount = 0;
|
||||||
|
g_cpu_irqset &= ~(1 << this_cpu());
|
||||||
|
|
||||||
|
/* Have all CPUs release the lock? */
|
||||||
|
|
||||||
|
if (g_cpu_irqset == 0)
|
||||||
{
|
{
|
||||||
up_release_pending();
|
/* Unlock the IRQ spinlock */
|
||||||
|
|
||||||
|
spin_unlock(g_cpu_irqlock);
|
||||||
|
|
||||||
|
/* Check if there are pending tasks and that pre-emption is
|
||||||
|
* also enabled.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (g_pendingtasks.head != NULL && !spin_islocked(&g_cpu_schedlock))
|
||||||
|
{
|
||||||
|
/* Release any ready-to-run tasks that have collected in
|
||||||
|
* g_pendingtasks if the scheduler is not locked.
|
||||||
|
*
|
||||||
|
* NOTE: This operation has a very high likelihood of causing
|
||||||
|
* this task to be switched out!
|
||||||
|
*/
|
||||||
|
|
||||||
|
up_release_pending();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
|
||||||
* is now the new active task!
|
* is now the new active task!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ASSERT(rtcb->lockcount == 0 && btcb->flink != NULL);
|
ASSERT(!spin_islocked(&g_cpu_schedlock) && btcb->flink != NULL);
|
||||||
|
|
||||||
btcb->task_state = TSTATE_TASK_RUNNING;
|
btcb->task_state = TSTATE_TASK_RUNNING;
|
||||||
btcb->flink->task_state = TSTATE_TASK_READYTORUN;
|
btcb->flink->task_state = TSTATE_TASK_READYTORUN;
|
||||||
|
@ -341,7 +341,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
next = (FAR struct tcb_s *)btcb->flink;
|
next = (FAR struct tcb_s *)btcb->flink;
|
||||||
ASSERT(!rtcb->lockcount && next != NULL);
|
ASSERT(!spin_islocked(&g_cpu_schedlock) && next != NULL);
|
||||||
|
|
||||||
if ((next->flags & TCB_FLAG_CPU_ASSIGNED) != 0)
|
if ((next->flags & TCB_FLAG_CPU_ASSIGNED) != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue