/*
- * Copyright (c) 2003 The Regents of The University of Michigan
+ * Copyright (c) 2000-2003 The Regents of The University of Michigan
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
using namespace std;
-const string Event::defaultName("event");
-
//
// Main Event Queue
//
else
event->clearFlags(Event::Squashed);
- if (event->getFlags(Event::AutoDelete))
+ if (event->getFlags(Event::AutoDelete) && !event->scheduled())
delete event;
}
while (event) {
if (event->getFlags(Event::AutoSerialize)) {
eventPtrs.push_back(event);
- numEvents++;
+ paramOut(os, csprintf("event%d", numEvents++), event->name());
}
event = event->next;
}
SERIALIZE_SCALAR(numEvents);
- int i = 0;
- for (std::list<Event *>::iterator it=eventPtrs.begin();
- it != eventPtrs.end(); ++it) {
- paramOut(os, csprintf("%s.eventPtr%d", name(), i++), (uintptr_t)*it);
- }
-
for (std::list<Event *>::iterator it=eventPtrs.begin();
it != eventPtrs.end(); ++it) {
(*it)->nameOut(os);
EventQueue::unserialize(Checkpoint *cp, const std::string §ion)
{
int numEvents;
- uintptr_t ptr;
-
UNSERIALIZE_SCALAR(numEvents);
+ std::string eventName;
for (int i = 0; i < numEvents; i++) {
// get the pointer value associated with the event
- paramIn(cp, section, csprintf("%s.eventPtr%d", name(), i), ptr);
+ paramIn(cp, section, csprintf("event%d", i), eventName);
// create the event based on its pointer value
- Serializeable::create(cp, csprintf("%s_%x", Event::defaultName, ptr));
+ Serializable::create(cp, eventName);
}
}
cprintf("============================================================\n");
}
+extern "C"
+void
+dumpMainQueue()
+{
+ mainEventQueue.dump();
+}
+
const char *
Event::description()
void
Event::dump()
{
+ cprintf("Event (%s)\n", description());
+ cprintf("Flags: %#x\n", _flags);
#if TRACING_ON
- cprintf(" Created: %d\n", when_created);
+ cprintf("Created: %d\n", when_created);
#endif
if (scheduled()) {
#if TRACING_ON
- cprintf(" Scheduled at %d\n", when_scheduled);
+ cprintf("Scheduled at %d\n", when_scheduled);
#endif
- cprintf(" Scheduled for %d\n", when());
+ cprintf("Scheduled for %d, priority %d\n", when(), _priority);
}
else {
- cprintf(" Not Scheduled\n");
+ cprintf("Not Scheduled\n");
}
}