Reader-Writer problem with condition variables