summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-08-22 18:40:32 -0700
committerGabe Black <gabeblack@google.com>2018-09-25 23:56:47 +0000
commit46b85b66374f30af7e97254e45d534ef8a7a11ba (patch)
treec6eb33f82fb11499813beeade6624ed4ebc7696d /src
parenta0f2391fc143cbe505c2cedffb477713bbc85cbe (diff)
downloadgem5-46b85b66374f30af7e97254e45d534ef8a7a11ba.tar.xz
systemc: If an event is a delta notification, checked if it's timed.
If we're descheduling an event which is at the current time, it may have been scheduled as a delta notification, but it could have also been scheduled as a timed notification and we just got to that point in time. If an event is for the current time but isn't in the delta notifications, this change detects that and then treats it as a timed notification. Change-Id: I1d8f4c40325cc7f355b7f2e6f08611483ce11858 Reviewed-on: https://gem5-review.googlesource.com/12250 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/systemc/core/scheduler.hh11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh
index 697aa11ad..3068a0aaa 100644
--- a/src/systemc/core/scheduler.hh
+++ b/src/systemc/core/scheduler.hh
@@ -238,10 +238,11 @@ class Scheduler
deschedule(ScEvent *event)
{
if (event->when() == getCurTick()) {
- // Remove from delta notifications.
- deltas.erase(event);
- event->deschedule();
- return;
+ // Attempt to remove from delta notifications.
+ if (deltas.erase(event) == 1) {
+ event->deschedule();
+ return;
+ }
}
// Timed notification/timeout.
@@ -250,7 +251,7 @@ class Scheduler
"Descheduling event at time with no events.");
TimeSlot *ts = tsit->second;
ScEvents &events = ts->events;
- events.erase(event);
+ assert(events.erase(event));
event->deschedule();
// If no more events are happening at this time slot, get rid of it.