pthreads :: Barrier :: wait
count
# Wait at this barrier and block until there are a `count` threads waiting fun wait do mutex.lock threads_waiting += 1 if threads_waiting == count then threads_waiting = 0 cond.broadcast else cond.wait(mutex.native.as(not null)) end mutex.unlock end