mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 20:56:47 +08:00
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:
@@ -68,13 +68,6 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond)
|
|||||||
}
|
}
|
||||||
else
|
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. */
|
/* Loop until all of the waiting threads have been restarted. */
|
||||||
|
|
||||||
while (cond->wait_count > 0)
|
while (cond->wait_count > 0)
|
||||||
@@ -92,10 +85,6 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond)
|
|||||||
|
|
||||||
cond->wait_count--;
|
cond->wait_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we can let the restarted threads run */
|
|
||||||
|
|
||||||
sched_unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sinfo("Returning %d\n", ret);
|
sinfo("Returning %d\n", ret);
|
||||||
|
|||||||
Reference in New Issue
Block a user