!51 为资源回收进程添加一个保护标签

Merge pull request !51 from likailong/master
This commit is contained in:
openharmony_ci 2020-12-26 14:03:40 +08:00 committed by Gitee
commit 0d56a61aa8
4 changed files with 21 additions and 4 deletions

View File

@ -610,7 +610,6 @@ STATIC LosProcessCB *OsGetFreePCB(VOID)
if (LOS_ListEmpty(&g_freeProcess)) {
SCHEDULER_UNLOCK(intSave);
PRINT_ERR("No idle PCB in the system!\n");
__asm__ __volatile__("swi 0");
return NULL;
}

View File

@ -766,7 +766,6 @@ LITE_OS_SEC_TEXT LosTaskCB *OsGetFreeTaskCB(VOID)
if (LOS_ListEmpty(&g_losFreeTask)) {
SCHEDULER_UNLOCK(intSave);
PRINT_ERR("No idle TCB in the system!\n");
LOS_Panic("**************error***************\n");
return NULL;
}
@ -1205,6 +1204,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskID)
OS_GOTO_ERREND();
}
if ((taskCB->taskStatus & OS_TASK_FLAG_SYSTEM_TASK) ||
(taskCB->taskStatus & OS_TASK_FLAG_NO_DELETE)) {
SCHEDULER_UNLOCK(intSave);
OsBackTrace();
__asm__ __volatile__("swi 0");
return LOS_ERRNO_TSK_OPERATE_SYSTEM_TASK;
}
processCB = OS_PCB_FROM_PID(taskCB->processID);
if (processCB->threadNumber == 1) {
if (processCB == OsCurrProcessGet()) {
@ -1990,7 +1996,11 @@ LITE_OS_SEC_TEXT UINT32 OsCreateResourceFreeTask(VOID)
taskInitParam.uwStackSize = OS_TASK_RESOURCE_STATCI_SIZE;
taskInitParam.pcName = "ResourcesTask";
taskInitParam.usTaskPrio = OS_TASK_RESOURCE_FREE_PRIORITY;
return LOS_TaskCreate(&taskID, &taskInitParam);
ret = LOS_TaskCreate(&taskID, &taskInitParam);
if (ret == LOS_OK) {
OS_TCB_FROM_TID(taskID)->taskStatus |= OS_TASK_FLAG_NO_DELETE;
}
return ret;
}
#ifdef __cplusplus

View File

@ -211,6 +211,14 @@ extern SPIN_LOCK_S g_taskSpin;
*/
#define OS_TASK_FLAG_SPECIFIES_PROCESS 0x4000U
/**
* @ingroup los_task
* Flag that indicates the task property.
*
* The task is system-level task, like ResourcesTask.
*/
#define OS_TASK_FLAG_NO_DELETE 0x8000U
/**
* @ingroup los_task
* Boundary on which the stack size is aligned.

View File

@ -1626,7 +1626,7 @@ VOID OsWaitConsoleSendTaskPend(UINT32 taskID)
UINT32 i;
CONSOLE_CB *console = NULL;
LosTaskCB *taskCB = NULL;
INT32 waitTime = 30000; /* 30000: 30 seconds*/
INT32 waitTime = 3000; /* 3000: 3 seconds*/
for (i = 0; i < CONSOLE_NUM; i++) {
console = g_console[i];