enh: refactor scheduler code

This commit is contained in:
dapan1121 2022-07-02 19:55:33 +08:00
parent 9e00672c60
commit 2f1cc7ae60
2 changed files with 12 additions and 0 deletions

View File

@ -41,6 +41,10 @@ SSchStatusFps gSchTaskFps[JOB_TASK_STATUS_MAX] = {
{JOB_TASK_STATUS_DROP, schTaskStatusNullEnter, schTaskStatusNullLeave, schTaskStatusNullEvent},
};
int32_t schSwitchJobStatus(int32_t status, SSchJob* pJob, void* pParam) {
schJobStatusEnter(pJob, status, pParam);
}

View File

@ -75,6 +75,14 @@ int32_t schedulerExecJob(SSchedulerReq *pReq, int64_t *pJobId) {
SCH_ERR_RET(schJobStatusEnter(&pJob, JOB_TASK_STATUS_INIT, pReq));
SSchEvent event = {0};
event.event = SCH_EVENT_BEGIN_OP;
SSchOpEvent opEvent = {0};
opEvent.type = SCH_OP_EXEC;
opEvent.begin = true;
opEvent.pReq = pReq;
schJobHandleEvent(pJob, &event);
SCH_ERR_RET(schJobStatusEnter(&pJob, JOB_TASK_STATUS_EXEC, pReq));
*pJobId = pJob->refId;