提交 0d56a61a 编写于 作者: O openharmony_ci 提交者: Gitee

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

Merge pull request !51 from likailong/master
......@@ -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;
}
......
......@@ -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
......
......@@ -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.
......
......@@ -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];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册