Replace rest in previous commit with a condition variable