remove sched_lock in pthread_cond_broadcast

reason:
Since pthread_cond_broadcast is already protected by a mutex,
even if sem_post causes a context switch, it will not affect the count of wait_count.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2024-11-15 15:57:31 +08:00 committed by Xiang Xiao
parent fa9bf63faf
commit 2714f1b605

View file

@ -68,13 +68,6 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond)
}
else
{
/* Disable pre-emption until all of the waiting threads have been
* restarted. This is necessary to assure that the sval behaves as
* expected in the following while loop
*/
sched_lock();
/* Loop until all of the waiting threads have been restarted. */
while (cond->wait_count > 0)
@ -92,10 +85,6 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond)
cond->wait_count--;
}
/* Now we can let the restarted threads run */
sched_unlock();
}
sinfo("Returning %d\n", ret);