sched: replace some global variables to macro

replace to macro will help to extend the scheduling implementation

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an
2024-03-20 12:22:08 +08:00
committed by Xiang Xiao
parent d90e1cb7b4
commit 4e62d0005a
14 changed files with 83 additions and 74 deletions
+5 -5
View File
@@ -192,7 +192,7 @@ try_again:
* lists are valid.
*/
if (g_nx_initstate >= OSINIT_TASKLISTS)
if (nxsched_initstate() >= OSINIT_TASKLISTS)
{
/* If called from an interrupt handler, then just take the spinlock.
* If we are already in a critical section, this will lock the CPU
@@ -416,7 +416,7 @@ irqstate_t enter_critical_section(void)
* lists have been initialized.
*/
if (!up_interrupt_context() && g_nx_initstate >= OSINIT_TASKLISTS)
if (!up_interrupt_context() && nxsched_initstate() >= OSINIT_TASKLISTS)
{
FAR struct tcb_s *rtcb = this_task();
DEBUGASSERT(rtcb != NULL);
@@ -463,7 +463,7 @@ void leave_critical_section(irqstate_t flags)
* lists are valid.
*/
if (g_nx_initstate >= OSINIT_TASKLISTS)
if (nxsched_initstate() >= OSINIT_TASKLISTS)
{
/* If called from an interrupt handler, then just release the
* spinlock. The interrupt handling logic should already hold the
@@ -608,7 +608,7 @@ void leave_critical_section(irqstate_t flags)
* lists have been initialized.
*/
if (!up_interrupt_context() && g_nx_initstate >= OSINIT_TASKLISTS)
if (!up_interrupt_context() && nxsched_initstate() >= OSINIT_TASKLISTS)
{
FAR struct tcb_s *rtcb = this_task();
DEBUGASSERT(rtcb != NULL);
@@ -667,7 +667,7 @@ bool irq_cpu_locked(int cpu)
/* g_cpu_irqset is not valid in early phases of initialization */
if (g_nx_initstate < OSINIT_OSREADY)
if (nxsched_initstate() < OSINIT_OSREADY)
{
/* We are still single threaded. In either state of g_cpu_irqlock,
* the correct return value should always be false.