diff options
Diffstat (limited to 'src/sim/eventq_impl.hh')
-rw-r--r-- | src/sim/eventq_impl.hh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/sim/eventq_impl.hh b/src/sim/eventq_impl.hh index 360731d7b..f0755ac8f 100644 --- a/src/sim/eventq_impl.hh +++ b/src/sim/eventq_impl.hh @@ -59,6 +59,7 @@ EventQueue::schedule(Event *event, Tick when, bool global) insert(event); } event->flags.set(Event::Scheduled); + event->acquire(); if (DTRACE(Event)) event->trace("scheduled"); @@ -79,8 +80,7 @@ EventQueue::deschedule(Event *event) if (DTRACE(Event)) event->trace("descheduled"); - if (event->flags.isSet(Event::AutoDelete)) - delete event; + event->release(); } inline void @@ -91,8 +91,11 @@ EventQueue::reschedule(Event *event, Tick when, bool always) assert(event->initialized()); assert(!inParallelMode || this == curEventQueue()); - if (event->scheduled()) + if (event->scheduled()) { remove(event); + } else { + event->acquire(); + } event->setWhen(when, this); insert(event); |