sim: do not exit on empty event loop

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-03-03 16:44:23 +01:00
parent 5c896dfd3d
commit 83209c0c33
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E

View File

@ -119,7 +119,7 @@ class Sim:
return event
except IndexError:
print("No more events in the simulation queue. Terminating.")
sys.exit(0)
return None
def cancel_event(self, event):
"""
@ -151,6 +151,8 @@ class Sim:
while self.time <= self.duration:
# get next event and call the handle method of the destination
event = self.next_event()
if not event:
return
dst = event.get_destination()
dst.handle_event(event)
# get current real time