X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fsim%2Feventq.hh;h=e28c43bb774b8630bb68d470f0dbbe6dc13d7300;hb=a368fba7d4fa01b58d5c2d9b3cafd56e1102287c;hp=7c814d87246c34096aeeb978f53251c6b90581ed;hpb=f32674d9bcfc801a5f9c24c8d96c6f417391325f;p=gem5.git diff --git a/src/sim/eventq.hh b/src/sim/eventq.hh index 7c814d872..e28c43bb7 100644 --- a/src/sim/eventq.hh +++ b/src/sim/eventq.hh @@ -136,7 +136,7 @@ class Event : public Serializable, public FastAlloc queue = q; #endif #ifdef EVENTQ_DEBUG - whenScheduled = curTick; + whenScheduled = curTick(); #endif } @@ -254,7 +254,7 @@ class Event : public Serializable, public FastAlloc queue = NULL; #endif #ifdef EVENTQ_DEBUG - whenCreated = curTick; + whenCreated = curTick(); whenScheduled = 0; #endif } @@ -370,10 +370,11 @@ class EventQueue : public Serializable void insert(Event *event); void remove(Event *event); + EventQueue(const EventQueue &); + const EventQueue &operator=(const EventQueue &); + public: - EventQueue(const std::string &n) - : objName(n), head(NULL) - {} + EventQueue(const std::string &n); virtual const std::string name() const { return objName; } @@ -404,15 +405,15 @@ class EventQueue : public Serializable } } - // default: process all events up to 'now' (curTick) - void serviceEvents() { serviceEvents(curTick); } + // default: process all events up to 'now' (curTick()) + void serviceEvents() { serviceEvents(curTick()); } // return true if no events are queued bool empty() const { return head == NULL; } void dump() const; - Tick nextEventTime() { return empty() ? curTick : head->when(); } + Tick nextEventTime() { return empty() ? curTick() : head->when(); } bool debugVerify() const; @@ -440,6 +441,11 @@ class EventManager return eventq; } + operator EventQueue *() const + { + return eventq; + } + void schedule(Event &event, Tick when) { @@ -480,7 +486,7 @@ class EventManager inline void EventQueue::schedule(Event *event, Tick when) { - assert((UTick)when >= (UTick)curTick); + assert((UTick)when >= (UTick)curTick()); assert(!event->scheduled()); assert(event->initialized()); @@ -517,7 +523,7 @@ EventQueue::deschedule(Event *event) inline void EventQueue::reschedule(Event *event, Tick when, bool always) { - assert(when >= curTick); + assert(when >= curTick()); assert(always || event->scheduled()); assert(event->initialized()); @@ -571,6 +577,13 @@ class EventWrapper : public Event setFlags(AutoDelete); } + EventWrapper(T &obj, bool del = false, Priority p = Default_Pri) + : Event(p), object(&obj) + { + if (del) + setFlags(AutoDelete); + } + void process() { (object->*F)(); } const std::string