sched: clear waitsem and msgwaitq after remove blocked

This commit is contained in:
zhangyuan21 2022-09-22 10:32:09 +08:00 committed by Xiang Xiao
parent af72a528f1
commit 40366f4153
6 changed files with 4 additions and 12 deletions

View File

@ -303,7 +303,6 @@ ssize_t nxmq_do_receive(FAR struct mqueue_inode_s *msgq,
wd_cancel(&btcb->waitdog);
}
btcb->waitobj = NULL;
msgq->nwaitnotfull--;
up_unblock_task(btcb);
}

View File

@ -410,7 +410,6 @@ int nxmq_do_send(FAR struct mqueue_inode_s *msgq,
wd_cancel(&btcb->waitdog);
}
btcb->waitobj = NULL;
msgq->nwaitnotempty--;
up_unblock_task(btcb);
}

View File

@ -83,8 +83,6 @@ void nxmq_wait_irq(FAR struct tcb_s *wtcb, int errcode)
msgq = wtcb->waitobj;
DEBUGASSERT(msgq);
wtcb->waitobj = NULL;
/* Decrement the count of waiters and cancel the wait */
if (wtcb->task_state == TSTATE_WAIT_MQNOTEMPTY)

View File

@ -67,6 +67,10 @@ void nxsched_remove_blocked(FAR struct tcb_s *btcb)
dq_rem((FAR dq_entry_t *)btcb, TLIST_BLOCKED(task_state));
/* Indicate that the wait is over. */
btcb->waitobj = NULL;
/* Make sure the TCB's state corresponds to not being in
* any list
*/

View File

@ -155,10 +155,6 @@ int nxsem_post(FAR sem_t *sem)
wd_cancel(&stcb->waitdog);
/* It is, let the task take the semaphore */
stcb->waitobj = NULL;
/* Restart the waiting task. */
up_unblock_task(stcb);

View File

@ -97,10 +97,6 @@ void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode)
sem->semcount++;
/* Indicate that the semaphore wait is over. */
wtcb->waitobj = NULL;
/* Mark the errno value for the thread. */
wtcb->errcode = errcode;