|
|
@ -1134,6 +1134,41 @@ STATUS taskCpuAffinityGet(int tid, cpuset_t* pAffinity) |
|
|
|
return (OK); |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
|
* sort the ID list by priority |
|
|
|
*/ |
|
|
|
void taskIdListSort (TASK_ID idList[], int nTasks) |
|
|
|
{ |
|
|
|
FAST TASK_ID tid; /* temp variable to store task ID */ |
|
|
|
int prevPri; /* previous priority */ |
|
|
|
int curPri; /* current priority */ |
|
|
|
FAST TASK_ID *pCurId; /* current task ID */ |
|
|
|
BOOL change = TRUE; /* variable to control while loop */ |
|
|
|
FAST TASK_ID *pEndId = &idList[nTasks]; /* last task ID */ |
|
|
|
|
|
|
|
if (nTasks == 0) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
while (change) { |
|
|
|
change = FALSE; |
|
|
|
|
|
|
|
/* Ignore bad taskId's, taskShow() will ignore them */ |
|
|
|
taskPriorityGet(idList[0], &prevPri); |
|
|
|
|
|
|
|
for (pCurId = &idList[1]; pCurId < pEndId; ++pCurId, prevPri = curPri) { |
|
|
|
taskPriorityGet(*pCurId, &curPri); |
|
|
|
|
|
|
|
if (prevPri > curPri) { |
|
|
|
tid = *pCurId; |
|
|
|
*pCurId = *(pCurId - 1); |
|
|
|
*(pCurId - 1) = tid; |
|
|
|
change = TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*
|
|
|
|
* end |
|
|
|
*/ |
|
|
|