use boost::mutex::condition and condition.wait instead of sleep