pthread: remove enter_critical_section in pthread_barrier_wait

reason:
We decouple semcount from business logic by using an independent counting variable,
which allows us to remove critical sections in many cases.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2024-11-15 10:24:20 +08:00
committed by Xiang Xiao
parent 370eefb491
commit 7ba0f11d70
3 changed files with 14 additions and 42 deletions
+2
View File
@@ -87,6 +87,8 @@ int pthread_barrier_init(FAR pthread_barrier_t *barrier,
{
sem_init(&barrier->sem, 0, 0);
barrier->count = count;
barrier->wait_count = 0;
nxmutex_init(&barrier->mutex);
}
return ret;