Implement handling of barriers.