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:
Jukka Laitinen
2025-05-15 10:36:20 +03:00
committed by Xiang Xiao
parent ccc974b224
commit 6ed21ec1af
6 changed files with 7 additions and 30 deletions
+1 -4
View File
@@ -253,10 +253,7 @@ void nxmq_notify_receive(FAR struct mqueue_inode_s *msgq)
DEBUGASSERT(btcb != NULL);
if (WDOG_ISACTIVE(&btcb->waitdog))
{
wd_cancel(&btcb->waitdog);
}
wd_cancel(&btcb->waitdog);
msgq->cmn.nwaitnotfull--;
+1 -4
View File
@@ -286,10 +286,7 @@ void nxmq_notify_send(FAR struct mqueue_inode_s *msgq)
DEBUGASSERT(btcb);
if (WDOG_ISACTIVE(&btcb->waitdog))
{
wd_cancel(&btcb->waitdog);
}
wd_cancel(&btcb->waitdog);
msgq->cmn.nwaitnotempty--;
+1 -4
View File
@@ -252,10 +252,7 @@ ssize_t msgrcv(int msqid, FAR void *msgp, size_t msgsz, long msgtyp,
DEBUGASSERT(btcb != NULL);
if (WDOG_ISACTIVE(&btcb->waitdog))
{
wd_cancel(&btcb->waitdog);
}
wd_cancel(&btcb->waitdog);
msgq->cmn.nwaitnotfull--;
+1 -4
View File
@@ -245,10 +245,7 @@ int msgsnd(int msqid, FAR const void *msgp, size_t msgsz, int msgflg)
DEBUGASSERT(btcb);
if (WDOG_ISACTIVE(&btcb->waitdog))
{
wd_cancel(&btcb->waitdog);
}
wd_cancel(&btcb->waitdog);
msgq->cmn.nwaitnotempty--;
+1 -4
View File
@@ -209,10 +209,7 @@ int nxsem_post_slow(FAR sem_t *sem)
/* Stop the watchdog timer */
if (WDOG_ISACTIVE(&stcb->waitdog))
{
wd_cancel(&stcb->waitdog);
}
wd_cancel(&stcb->waitdog);
/* Indicate that the wait is over. */
+2 -10
View File
@@ -544,11 +544,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info,
}
sigemptyset(&stcb->sigwaitmask);
if (WDOG_ISACTIVE(&stcb->waitdog))
{
wd_cancel(&stcb->waitdog);
}
wd_cancel(&stcb->waitdog);
/* Remove the task from waiting list */
@@ -606,11 +602,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info,
}
sigemptyset(&stcb->sigwaitmask);
if (WDOG_ISACTIVE(&stcb->waitdog))
{
wd_cancel(&stcb->waitdog);
}
wd_cancel(&stcb->waitdog);
/* Remove the task from waiting list */