代码如下:不明白为什么有个大括号呢? if ,endif 是配套使用的哈
void OSSched(void)
{
uint8 temp;
OS_ENTER_CRITICAL();
#if EN_OS_INT_ENTER > 0
if (OSIntNesting == 0)
{
#endif // 就是这里了。为什么在上面那个if条件判断语句中,有了个endif。 下面可是还要执行的啊。 if和endif之间怎么会有一个条件判断语句?
#if OS_MAX_TASKS < 9
temp = OSTaskRuning;
for (OSNextTaskID = 0; OSNextTaskID < OS_MAX_TASKS; OSNextTaskID++)
{
if ((temp & 0x01) != 0)
{
break;
}
temp = temp >> 1;
}
OS_TASK_SW();
#else
temp = OSTaskRuning % 256;
for (OSNextTaskID = 0; OSNextTaskID < 8; OSNextTaskID++)
{
if ((temp & 0x01) != 0)
{
goto TaskSw;
}
temp = temp >> 1;
}
temp = OSTaskRuning / 256 ;
for (; OSNextTaskID < OS_MAX_TASKS; OSNextTaskID++)
{
if ((temp & 0x01) != 0)
{
break;
}
temp = temp >> 1;
}
TaskSw:
OS_TASK_SW(); /* 进行任务调度 */
#endif
#if EN_OS_INT_ENTER > 0
}
#endif
OS_EXIT_CRITICAL();
}
|