Moved condition variable notifications outside of locked scopes.