提交 3dd32b99 编写于 作者: L likailong

Description: add protect flag to resource task

Reviewed-by: shenwei and zhangfanfan
上级 05e11d40
...@@ -610,7 +610,6 @@ STATIC LosProcessCB *OsGetFreePCB(VOID) ...@@ -610,7 +610,6 @@ STATIC LosProcessCB *OsGetFreePCB(VOID)
if (LOS_ListEmpty(&g_freeProcess)) { if (LOS_ListEmpty(&g_freeProcess)) {
SCHEDULER_UNLOCK(intSave); SCHEDULER_UNLOCK(intSave);
PRINT_ERR("No idle PCB in the system!\n"); PRINT_ERR("No idle PCB in the system!\n");
__asm__ __volatile__("swi 0");
return NULL; return NULL;
} }
......
...@@ -766,7 +766,6 @@ LITE_OS_SEC_TEXT LosTaskCB *OsGetFreeTaskCB(VOID) ...@@ -766,7 +766,6 @@ LITE_OS_SEC_TEXT LosTaskCB *OsGetFreeTaskCB(VOID)
if (LOS_ListEmpty(&g_losFreeTask)) { if (LOS_ListEmpty(&g_losFreeTask)) {
SCHEDULER_UNLOCK(intSave); SCHEDULER_UNLOCK(intSave);
PRINT_ERR("No idle TCB in the system!\n"); PRINT_ERR("No idle TCB in the system!\n");
LOS_Panic("**************error***************\n");
return NULL; return NULL;
} }
...@@ -1205,6 +1204,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskID) ...@@ -1205,6 +1204,13 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_TaskDelete(UINT32 taskID)
OS_GOTO_ERREND(); 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); processCB = OS_PCB_FROM_PID(taskCB->processID);
if (processCB->threadNumber == 1) { if (processCB->threadNumber == 1) {
if (processCB == OsCurrProcessGet()) { if (processCB == OsCurrProcessGet()) {
...@@ -1990,7 +1996,11 @@ LITE_OS_SEC_TEXT UINT32 OsCreateResourceFreeTask(VOID) ...@@ -1990,7 +1996,11 @@ LITE_OS_SEC_TEXT UINT32 OsCreateResourceFreeTask(VOID)
taskInitParam.uwStackSize = OS_TASK_RESOURCE_STATCI_SIZE; taskInitParam.uwStackSize = OS_TASK_RESOURCE_STATCI_SIZE;
taskInitParam.pcName = "ResourcesTask"; taskInitParam.pcName = "ResourcesTask";
taskInitParam.usTaskPrio = OS_TASK_RESOURCE_FREE_PRIORITY; 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 #ifdef __cplusplus
......
...@@ -211,6 +211,14 @@ extern SPIN_LOCK_S g_taskSpin; ...@@ -211,6 +211,14 @@ extern SPIN_LOCK_S g_taskSpin;
*/ */
#define OS_TASK_FLAG_SPECIFIES_PROCESS 0x4000U #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 * @ingroup los_task
* Boundary on which the stack size is aligned. * Boundary on which the stack size is aligned.
......
...@@ -1626,7 +1626,7 @@ VOID OsWaitConsoleSendTaskPend(UINT32 taskID) ...@@ -1626,7 +1626,7 @@ VOID OsWaitConsoleSendTaskPend(UINT32 taskID)
UINT32 i; UINT32 i;
CONSOLE_CB *console = NULL; CONSOLE_CB *console = NULL;
LosTaskCB *taskCB = NULL; LosTaskCB *taskCB = NULL;
INT32 waitTime = 30000; /* 30000: 30 seconds*/ INT32 waitTime = 3000; /* 3000: 3 seconds*/
for (i = 0; i < CONSOLE_NUM; i++) { for (i = 0; i < CONSOLE_NUM; i++) {
console = g_console[i]; console = g_console[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册