Mechanisms and processes for synchronizing a group of threads that use a
semaphore for each waiting thread to implement a barrier. A barrier is
created comprising a counter, a semaphore list, and at least one mutual
exclusion (mutex) lock. For each thread using the barrier, it is
determined whether that thread is the last to arrive. For each thread
that is not the last to arrive at the barrier, the thread is caused to
wait on a semaphore. The last thread to arrive at the barrier causes each
waiting thread to resume execution.