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

Merge pull request !265 from zhushengle/sched_time
This commit is contained in:
openharmony_ci 2021-08-14 06:23:30 +00:00 committed by Gitee
commit 02beb6b04d
3 changed files with 9 additions and 8 deletions

View File

@ -93,11 +93,11 @@ VOID OsSchedTimerBaseReset(UINT64 currTime);
STATIC INLINE UINT64 OsGetCurrSchedTimeCycle(VOID)
{
if (g_sysSchedStartTime == 0) {
return g_sysSchedStartTime;
if (g_sysSchedStartTime != OS_64BIT_MAX) {
return (OsGetCurrSysTimeCycle() - g_sysSchedStartTime);
}
return (OsGetCurrSysTimeCycle() - g_sysSchedStartTime);
return 0;
}
/**

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);

View File

@ -354,6 +354,7 @@ typedef signed int INTPTR;
#define OS_FAIL 1
#define OS_ERROR (UINT32)(-1)
#define OS_INVALID (UINT32)(-1)
#define OS_64BIT_MAX (0xFFFFFFFFFFFFFFFFULL)
#define asm __asm
#ifdef typeof