fix: 以g_sysSchedStartTime是否为0判断时间轴是否生效存在极限场景导致调度时间不生效

初始化调度时间不以g_sysSchedStartTime是否为0为界限,而以g_sysSchedStartTime是否为64位最大值,
为界限, 避免特殊以下场景:调度开启时系统时间为0,导致初始化的g_sysSchedStartTime还是0,导致
调度启动后获取的调度时间轴始终为0.

Close #I45HP5

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ie0ef4e7d149f09ac466c649c0f2d6538f5322439
This commit is contained in:
zhushengle
2021-08-14 11:06:09 +08:00
parent 2868891bc8
commit 509cf59bef
3 changed files with 9 additions and 8 deletions

View File

@@ -60,13 +60,11 @@ STATIC UINT16 g_tickIntLock = 0;
STATIC UINT64 g_tickStartTime = 0;
STATIC UINT64 g_schedResponseTime = OS_SCHED_MAX_RESPONSE_TIME;
STATIC VOID (*SchedRealSleepTimeSet)(UINT64) = NULL;
UINT64 g_sysSchedStartTime = 0;
UINT64 g_sysSchedStartTime = OS_64BIT_MAX;
STATIC VOID OsSchedSetStartTime(UINT64 currCycle)
{
if (g_sysSchedStartTime == 0) {
g_sysSchedStartTime = currCycle;
}
g_sysSchedStartTime = currCycle;
}
UINT32 OsSchedRealSleepTimeSet(VOID (*func)(UINT64))
@@ -483,8 +481,10 @@ VOID OsSchedStart(VOID)
g_losTask.newTask = newTask;
g_losTask.runTask = g_losTask.newTask;
g_taskScheduled = 1;
/* Initialize the schedule timeline and enable scheduling */
g_taskScheduled = TRUE;
OsSchedSetStartTime(OsGetCurrSysTimeCycle());
newTask->startTime = OsGetCurrSchedTimeCycle();
OsSchedTaskDeQueue(newTask);