Added friend CondVar and fixed test app.