Skip to content

Commit

Permalink
chore: removed waiting for event update from the engine
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomoaccursi committed Jan 11, 2024
1 parent ccce5b6 commit 33b0e25
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main/kotlin/control/EngineImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ package control

import entity.Environment
import entity.Time
import kotlinx.coroutines.delay
import java.util.concurrent.CountDownLatch

/**
Expand All @@ -30,7 +29,6 @@ class EngineImpl(

override suspend fun start() {
scheduleEvents()
delay(1000)
status = Status.RUNNING
while (currentStep < maxSteps && status == Status.RUNNING) {
doStep()
Expand Down Expand Up @@ -74,9 +72,9 @@ class EngineImpl(
}
currentTime = scheduledTime
if (nextEvent.canExecute()) {
this.latch = CountDownLatch(nextEvent.getNumberOfEventExecutionObserver())
// this.latch = CountDownLatch(nextEvent.getNumberOfEventExecutionObserver())
nextEvent.execute()
waitForEventUpdate()
// waitForEventUpdate()
nextEvent.updateEvent(currentTime)
scheduler.eventsUpdated()
}
Expand All @@ -85,9 +83,9 @@ class EngineImpl(
currentStep += 1
}

private fun waitForEventUpdate() {
latch.await()
}
// private fun waitForEventUpdate() {
// latch.await()
// }

/**
* Enum for the status of the simulation.
Expand Down

0 comments on commit 33b0e25

Please sign in to comment.