summaryrefslogtreecommitdiff
path: root/sim/eventq.hh
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2004-03-05 05:45:45 -0500
committerNathan Binkert <binkertn@umich.edu>2004-03-05 05:45:45 -0500
commitec6265b044b131fbd9b2b8b97788646c29293d1e (patch)
treec7440b3d105162094e78762fa47ef5a0cb076d77 /sim/eventq.hh
parent34d36c45bf90ad64d63a64222c9d046c934d80c5 (diff)
downloadgem5-ec6265b044b131fbd9b2b8b97788646c29293d1e.tar.xz
constructor option to make the wrapped event autodelete
--HG-- extra : convert_revision : 8663c874c533685adf21eea968b08b40b7d7b665
Diffstat (limited to 'sim/eventq.hh')
-rw-r--r--sim/eventq.hh9
1 files changed, 7 insertions, 2 deletions
diff --git a/sim/eventq.hh b/sim/eventq.hh
index 60a61fa29..ed37fd4f4 100644
--- a/sim/eventq.hh
+++ b/sim/eventq.hh
@@ -243,10 +243,13 @@ class EventWrapper : public Event
T *object;
public:
- EventWrapper(T *obj, EventQueue *q = &mainEventQueue,
+ EventWrapper(T *obj, bool del = false, EventQueue *q = &mainEventQueue,
Priority p = Default_Pri)
: Event(q, p), object(obj)
- {}
+ {
+ if (del)
+ setFlags(AutoDelete);
+ }
void process() { (object->*F)(); }
};
@@ -324,6 +327,8 @@ inline void
Event::schedule(Tick t)
{
assert(!scheduled());
+ assert(t >= curTick);
+
setFlags(Scheduled);
#if TRACING_ON
when_scheduled = curTick;