Use semaphore-based barrier implementation rather than pthread_barrier