add condition variable in sample code