I need a barrier in my multi-thread project on Linux. I know the pthread_barrier_init() and pthread_barrier_wait(), but I want to run my project on android. It didn’t have these functions. I know how to implement it with atomic add and atomic comparison. I want to use a semaphore, can I use a semaphore to implement it?
I need a barrier in my multi-thread project on Linux. I know the pthread_barrier_init()
Share
Use a
CyclicBarrier, this is more or less identical to a pthread barrier.Sample code (from linked page)