sched/semaphore: Remove redundant clearing of mutex blocking bit in sem_waitirq

This is not a bug, but unnecessary code. If the mutex is no longer blocking,
the released thread will set the holder and clear the blocking bit in the end
of nxsem_wait.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
Jukka Laitinen 2025-05-21 11:47:13 +03:00 committed by Xiang Xiao
parent b5a284fd6d
commit f3231a1934

View file

@ -101,21 +101,12 @@ void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode)
/* This restores the value to what it was before the previous sem_wait.
* This caused the thread to be blocked in the first place.
*
* For mutexes, the holder is updated by the thread itself
* when it exits nxsem_wait
*/
if (mutex)
{
/* The TID of the mutex holder is correct but we need to
* update the blocking bit. The mutex is still blocking if there are
* any items left in the wait queue.
*/
if (dq_empty(SEM_WAITLIST(sem)))
{
atomic_fetch_and(NXSEM_MHOLDER(sem), ~NXSEM_MBLOCKING_BIT);
}
}
else
if (!mutex)
{
atomic_fetch_add(NXSEM_COUNT(sem), 1);
}