add condition variable templete