Pthread barrier implemenation for OS X