From 84f0a1bd91b8af5517711fba00533daddb2359e1 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Thu, 22 Sep 2011 18:59:55 -0700 Subject: event: minor cleanup Initialize flags via the Event constructor instead of calling setFlags() in the body of the derived class's constructor. I forget exactly why, but this made life easier when implementing multi-queue support. Also rename Event::getFlags() to isFlagSet() to better match common usage, and get rid of some unused Event methods. --- src/sim/eventq.hh | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'src/sim/eventq.hh') diff --git a/src/sim/eventq.hh b/src/sim/eventq.hh index fcfa119c4..1509d05a5 100644 --- a/src/sim/eventq.hh +++ b/src/sim/eventq.hh @@ -149,20 +149,13 @@ class Event : public Serializable, public FastAlloc return flags & PublicRead; } - Flags - getFlags(Flags _flags) const + bool + isFlagSet(Flags _flags) const { assert(_flags.noneSet(~PublicRead)); return flags.isSet(_flags); } - Flags - allFlags(Flags _flags) const - { - assert(_flags.noneSet(~PublicRead)); - return flags.allSet(_flags); - } - /// Accessor for flags. void setFlags(Flags _flags) @@ -247,9 +240,11 @@ class Event : public Serializable, public FastAlloc * Event constructor * @param queue that the event gets scheduled on */ - Event(Priority p = Default_Pri) - : nextBin(NULL), nextInBin(NULL), _priority(p), flags(Initialized) + Event(Priority p = Default_Pri, Flags f = 0) + : nextBin(NULL), nextInBin(NULL), _priority(p), + flags(Initialized | f) { + assert(f.noneSet(~PublicWrite)); #ifndef NDEBUG instance = ++instanceCounter; queue = NULL; @@ -406,16 +401,11 @@ class EventQueue : public Serializable } } - // 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(); } - bool debugVerify() const; #ifndef SWIG @@ -559,8 +549,8 @@ DelayFunction(EventQueue *eventq, Tick when, T *object) public: DelayEvent(T *o) - : object(o) - { this->setFlags(AutoDelete); } + : Event(Default_Pri, AutoDelete), object(o) + { } void process() { (object->*F)(); } const char *description() const { return "delay"; } }; -- cgit v1.2.3