mirror of
https://github.com/apache/nuttx.git
synced 2025-12-07 01:44:23 +08:00
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:
@@ -136,13 +136,13 @@ static void exec_swap(FAR struct tcb_s *ptcb, FAR struct tcb_s *chtcb)
|
||||
pndx = PIDHASH(ptcb->pid);
|
||||
chndx = PIDHASH(chtcb->pid);
|
||||
|
||||
DEBUGASSERT(g_pidhash[pndx]);
|
||||
DEBUGASSERT(g_pidhash[chndx]);
|
||||
DEBUGASSERT(nxsched_pidhash()[pndx]);
|
||||
DEBUGASSERT(nxsched_pidhash()[chndx]);
|
||||
|
||||
/* Exchange g_pidhash index */
|
||||
/* Exchange nxsched_pidhash() index */
|
||||
|
||||
g_pidhash[pndx] = chtcb;
|
||||
g_pidhash[chndx] = ptcb;
|
||||
nxsched_pidhash()[pndx] = chtcb;
|
||||
nxsched_pidhash()[chndx] = ptcb;
|
||||
|
||||
/* Exchange pid */
|
||||
|
||||
|
||||
@@ -187,9 +187,9 @@ static int elf_get_ntcb(void)
|
||||
int count = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < g_npidhash; i++)
|
||||
for (i = 0; i < nxsched_npidhash(); i++)
|
||||
{
|
||||
if (g_pidhash[i] != NULL)
|
||||
if (nxsched_pidhash()[i] != NULL)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
@@ -313,11 +313,11 @@ static void elf_emit_note(FAR struct elf_dumpinfo_s *cinfo)
|
||||
|
||||
if (cinfo->pid == INVALID_PROCESS_ID)
|
||||
{
|
||||
for (i = 0; i < g_npidhash; i++)
|
||||
for (i = 0; i < nxsched_npidhash(); i++)
|
||||
{
|
||||
if (g_pidhash[i] != NULL)
|
||||
if (nxsched_pidhash()[i] != NULL)
|
||||
{
|
||||
elf_emit_tcb_note(cinfo, g_pidhash[i]);
|
||||
elf_emit_tcb_note(cinfo, nxsched_pidhash()[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -395,11 +395,11 @@ static void elf_emit_stack(FAR struct elf_dumpinfo_s *cinfo)
|
||||
|
||||
if (cinfo->pid == INVALID_PROCESS_ID)
|
||||
{
|
||||
for (i = 0; i < g_npidhash; i++)
|
||||
for (i = 0; i < nxsched_npidhash(); i++)
|
||||
{
|
||||
if (g_pidhash[i] != NULL)
|
||||
if (nxsched_pidhash()[i] != NULL)
|
||||
{
|
||||
elf_emit_tcb_stack(cinfo, g_pidhash[i]);
|
||||
elf_emit_tcb_stack(cinfo, nxsched_pidhash()[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -520,11 +520,11 @@ static void elf_emit_phdr(FAR struct elf_dumpinfo_s *cinfo,
|
||||
|
||||
if (cinfo->pid == INVALID_PROCESS_ID)
|
||||
{
|
||||
for (i = 0; i < g_npidhash; i++)
|
||||
for (i = 0; i < nxsched_npidhash(); i++)
|
||||
{
|
||||
if (g_pidhash[i] != NULL)
|
||||
if (nxsched_pidhash()[i] != NULL)
|
||||
{
|
||||
elf_emit_tcb_phdr(cinfo, g_pidhash[i], &phdr, &offset);
|
||||
elf_emit_tcb_phdr(cinfo, nxsched_pidhash()[i], &phdr, &offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user