add condition variable and barrier