mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 07:45:16 +08:00
sched: Remove checking of WDOG_ISACTIVE when cancelling wdog
Checking only adds a race condition. The checking if the wdog is active or not must be done inside wd_cancel, where the proper spinlock is held Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
committed by
Xiang Xiao
parent
ccc974b224
commit
6ed21ec1af
@@ -253,10 +253,7 @@ void nxmq_notify_receive(FAR struct mqueue_inode_s *msgq)
|
|||||||
|
|
||||||
DEBUGASSERT(btcb != NULL);
|
DEBUGASSERT(btcb != NULL);
|
||||||
|
|
||||||
if (WDOG_ISACTIVE(&btcb->waitdog))
|
wd_cancel(&btcb->waitdog);
|
||||||
{
|
|
||||||
wd_cancel(&btcb->waitdog);
|
|
||||||
}
|
|
||||||
|
|
||||||
msgq->cmn.nwaitnotfull--;
|
msgq->cmn.nwaitnotfull--;
|
||||||
|
|
||||||
|
|||||||
@@ -286,10 +286,7 @@ void nxmq_notify_send(FAR struct mqueue_inode_s *msgq)
|
|||||||
|
|
||||||
DEBUGASSERT(btcb);
|
DEBUGASSERT(btcb);
|
||||||
|
|
||||||
if (WDOG_ISACTIVE(&btcb->waitdog))
|
wd_cancel(&btcb->waitdog);
|
||||||
{
|
|
||||||
wd_cancel(&btcb->waitdog);
|
|
||||||
}
|
|
||||||
|
|
||||||
msgq->cmn.nwaitnotempty--;
|
msgq->cmn.nwaitnotempty--;
|
||||||
|
|
||||||
|
|||||||
@@ -252,10 +252,7 @@ ssize_t msgrcv(int msqid, FAR void *msgp, size_t msgsz, long msgtyp,
|
|||||||
|
|
||||||
DEBUGASSERT(btcb != NULL);
|
DEBUGASSERT(btcb != NULL);
|
||||||
|
|
||||||
if (WDOG_ISACTIVE(&btcb->waitdog))
|
wd_cancel(&btcb->waitdog);
|
||||||
{
|
|
||||||
wd_cancel(&btcb->waitdog);
|
|
||||||
}
|
|
||||||
|
|
||||||
msgq->cmn.nwaitnotfull--;
|
msgq->cmn.nwaitnotfull--;
|
||||||
|
|
||||||
|
|||||||
@@ -245,10 +245,7 @@ int msgsnd(int msqid, FAR const void *msgp, size_t msgsz, int msgflg)
|
|||||||
|
|
||||||
DEBUGASSERT(btcb);
|
DEBUGASSERT(btcb);
|
||||||
|
|
||||||
if (WDOG_ISACTIVE(&btcb->waitdog))
|
wd_cancel(&btcb->waitdog);
|
||||||
{
|
|
||||||
wd_cancel(&btcb->waitdog);
|
|
||||||
}
|
|
||||||
|
|
||||||
msgq->cmn.nwaitnotempty--;
|
msgq->cmn.nwaitnotempty--;
|
||||||
|
|
||||||
|
|||||||
@@ -209,10 +209,7 @@ int nxsem_post_slow(FAR sem_t *sem)
|
|||||||
|
|
||||||
/* Stop the watchdog timer */
|
/* Stop the watchdog timer */
|
||||||
|
|
||||||
if (WDOG_ISACTIVE(&stcb->waitdog))
|
wd_cancel(&stcb->waitdog);
|
||||||
{
|
|
||||||
wd_cancel(&stcb->waitdog);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Indicate that the wait is over. */
|
/* Indicate that the wait is over. */
|
||||||
|
|
||||||
|
|||||||
@@ -544,11 +544,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sigemptyset(&stcb->sigwaitmask);
|
sigemptyset(&stcb->sigwaitmask);
|
||||||
|
wd_cancel(&stcb->waitdog);
|
||||||
if (WDOG_ISACTIVE(&stcb->waitdog))
|
|
||||||
{
|
|
||||||
wd_cancel(&stcb->waitdog);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove the task from waiting list */
|
/* Remove the task from waiting list */
|
||||||
|
|
||||||
@@ -606,11 +602,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sigemptyset(&stcb->sigwaitmask);
|
sigemptyset(&stcb->sigwaitmask);
|
||||||
|
wd_cancel(&stcb->waitdog);
|
||||||
if (WDOG_ISACTIVE(&stcb->waitdog))
|
|
||||||
{
|
|
||||||
wd_cancel(&stcb->waitdog);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove the task from waiting list */
|
/* Remove the task from waiting list */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user