Use barrier to let threads exit at same time