!685 fix: 优化liteipc任务状态,删除功能重复字段

Merge pull request !685 from zhushengle/liteipc
This commit is contained in:
openharmony_ci 2021-10-30 02:31:41 +00:00 committed by Gitee
commit ebfac57d54
5 changed files with 7 additions and 21 deletions

View File

@ -359,7 +359,6 @@ typedef struct {
UINT16 waitFlag; /**< The type of child process that is waiting, belonging to a group or parent,
a specific child process, or any child process */
#ifdef LOSCFG_KERNEL_LITEIPC
UINT32 ipcStatus;
LOS_DL_LIST msgListHead;
BOOL accessMap[LOSCFG_BASE_CORE_TSK_LIMIT];
#endif

View File

@ -157,13 +157,10 @@ STATIC UINT32 OsPendingTaskWake(LosTaskCB *taskCB, INT32 signo)
case OS_TASK_WAIT_SIGNAL:
OsSigWaitTaskWake(taskCB, signo);
break;
#ifdef LOSCFG_KERNEL_LITEIPC
case OS_TASK_WAIT_LITEIPC:
taskCB->ipcStatus &= ~IPC_THREAD_STATUS_PEND;
OsTaskWakeClearPendMask(taskCB);
OsSchedTaskWake(taskCB);
break;
#endif
case OS_TASK_WAIT_FUTEX:
OsFutexNodeDeleteFromFutexHash(&taskCB->futex, TRUE, NULL, NULL);
OsTaskWakeClearPendMask(taskCB);

View File

@ -472,9 +472,6 @@ STATIC INLINE VOID OsSchedWakePendTimeTask(UINT64 currTime, LosTaskCB *taskCB, B
if (tempStatus & (OS_TASK_STATUS_PENDING | OS_TASK_STATUS_DELAY)) {
taskCB->taskStatus &= ~(OS_TASK_STATUS_PENDING | OS_TASK_STATUS_PEND_TIME | OS_TASK_STATUS_DELAY);
if (tempStatus & OS_TASK_STATUS_PENDING) {
#ifdef LOSCFG_KERNEL_LITEIPC
taskCB->ipcStatus &= ~IPC_THREAD_STATUS_PEND;
#endif
taskCB->taskStatus |= OS_TASK_STATUS_TIMEOUT;
LOS_ListDelete(&taskCB->pendList);
taskCB->taskMux = NULL;

View File

@ -953,9 +953,8 @@ LITE_OS_SEC_TEXT STATIC UINT32 LiteIpcWrite(IpcContent *content)
SCHEDULER_LOCK(intSave);
LosTaskCB *tcb = OS_TCB_FROM_TID(dstTid);
LOS_ListTailInsert(&(tcb->msgListHead), &(buf->listNode));
OsHookCall(LOS_HOOK_TYPE_IPC_WRITE, &buf->msg, dstTid, tcb->processID, tcb->ipcStatus);
if (tcb->ipcStatus & IPC_THREAD_STATUS_PEND) {
tcb->ipcStatus &= ~IPC_THREAD_STATUS_PEND;
OsHookCall(LOS_HOOK_TYPE_IPC_WRITE, &buf->msg, dstTid, tcb->processID, tcb->waitFlag);
if (tcb->waitFlag == OS_TASK_WAIT_LITEIPC) {
OsTaskWakeClearPendMask(tcb);
OsSchedTaskWake(tcb);
SCHEDULER_UNLOCK(intSave);
@ -1011,11 +1010,11 @@ LITE_OS_SEC_TEXT STATIC UINT32 CheckRecievedMsg(IpcListNode *node, IpcContent *c
ret = -EINVAL;
}
if (ret != LOS_OK) {
OsHookCall(LOS_HOOK_TYPE_IPC_READ_DROP, &node->msg, tcb->ipcStatus);
OsHookCall(LOS_HOOK_TYPE_IPC_READ_DROP, &node->msg, tcb->waitFlag);
(VOID)HandleSpecialObjects(LOS_CurTaskIDGet(), node, TRUE);
(VOID)LiteIpcNodeFree(LOS_GetCurrProcessID(), (VOID *)node);
} else {
OsHookCall(LOS_HOOK_TYPE_IPC_READ, &node->msg, tcb->ipcStatus);
OsHookCall(LOS_HOOK_TYPE_IPC_READ, &node->msg, tcb->waitFlag);
}
return ret;
}
@ -1035,18 +1034,17 @@ LITE_OS_SEC_TEXT STATIC UINT32 LiteIpcRead(IpcContent *content)
do {
SCHEDULER_LOCK(intSave);
if (LOS_ListEmpty(listHead)) {
OsHookCall(LOS_HOOK_TYPE_IPC_TRY_READ, syncFlag ? MT_REPLY : MT_REQUEST, tcb->ipcStatus);
tcb->ipcStatus |= IPC_THREAD_STATUS_PEND;
OsTaskWaitSetPendMask(OS_TASK_WAIT_LITEIPC, OS_INVALID_VALUE, timeout);
OsHookCall(LOS_HOOK_TYPE_IPC_TRY_READ, syncFlag ? MT_REPLY : MT_REQUEST, tcb->waitFlag);
ret = OsSchedTaskWait(&g_ipcPendlist, timeout, TRUE);
if (ret == LOS_ERRNO_TSK_TIMEOUT) {
OsHookCall(LOS_HOOK_TYPE_IPC_READ_TIMEOUT, syncFlag ? MT_REPLY : MT_REQUEST, tcb->ipcStatus);
OsHookCall(LOS_HOOK_TYPE_IPC_READ_TIMEOUT, syncFlag ? MT_REPLY : MT_REQUEST, tcb->waitFlag);
SCHEDULER_UNLOCK(intSave);
return -ETIME;
}
if (OsTaskIsKilled(tcb)) {
OsHookCall(LOS_HOOK_TYPE_IPC_KILL, syncFlag ? MT_REPLY : MT_REQUEST, tcb->ipcStatus);
OsHookCall(LOS_HOOK_TYPE_IPC_KILL, syncFlag ? MT_REPLY : MT_REQUEST, tcb->waitFlag);
SCHEDULER_UNLOCK(intSave);
return -ERFKILL;
}

View File

@ -169,11 +169,6 @@ typedef struct {
VOID *buffToFree;
} IpcContent;
#define IPC_THREAD_STATUS_INVAL 0x0001U
#define IPC_THREAD_STATUS_START 0x0002U
#define IPC_THREAD_STATUS_PEND 0x0004U
#define IPC_THREAD_STATUS_STOP 0x0008U
/* init liteipc driver */
extern UINT32 OsLiteIpcInit(VOID);