Skip to content

Commit 7a36304

Browse files
committed
Enables rendering of the current state of traffic lights (red/green)
1 parent 1346fb0 commit 7a36304

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

src/Intersection.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,5 @@ void Intersection::processVehicleQueue()
143143
bool Intersection::trafficLightIsGreen()
144144
{
145145
// please include this part once you have solved the final project tasks
146-
/*
147-
if (_trafficLight.getCurrentPhase() == TrafficLightPhase::green)
148-
return true;
149-
else
150-
return false;
151-
*/
152-
153-
return true; // makes traffic light permanently green
146+
return _trafficLight.getCurrentPhase() == TrafficLightPhase::green;
154147
}

src/TrafficLight.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ void TrafficLight::simulate()
6565
}
6666

6767
void TrafficLight::toggleCurrentPhase() {
68-
std::lock_guard<std::mutex> lock(_currentPhase_mtx); // write is synchronized
6968
_currentPhase = _currentPhase == TrafficLightPhase::red ? TrafficLightPhase::green : TrafficLightPhase::red;
7069
_messages.send(std::move(_currentPhase));
7170
}

0 commit comments

Comments
 (0)