diff options
author | Steve Reinhardt <steve.reinhardt@amd.com> | 2011-09-22 18:59:55 -0700 |
---|---|---|
committer | Steve Reinhardt <steve.reinhardt@amd.com> | 2011-09-22 18:59:55 -0700 |
commit | 84f0a1bd91b8af5517711fba00533daddb2359e1 (patch) | |
tree | e9dd08fe7ff8a575efc08c5a927c719f674d06fe /src/sim/eventq.hh | |
parent | ba79155d9d0f42457f74b533e27f0af2ab1b5e4a (diff) | |
download | gem5-84f0a1bd91b8af5517711fba00533daddb2359e1.tar.xz |
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.
Diffstat (limited to 'src/sim/eventq.hh')
-rw-r--r-- | src/sim/eventq.hh | 26 |
1 files changed, 8 insertions, 18 deletions
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"; } }; |