diff -r 682695bc3ee7 -r 4eab81289ed0 src/base/pollevent.cc --- a/src/base/pollevent.cc Mon Sep 29 11:50:55 2014 +0100 +++ b/src/base/pollevent.cc Mon Sep 29 11:51:37 2014 +0100 @@ -44,6 +44,7 @@ #include "base/types.hh" #include "sim/async.hh" #include "sim/core.hh" +#include "sim/eventq.hh" #include "sim/serialize.hh" using namespace std; @@ -224,5 +225,7 @@ if (set) { async_event = true; async_io = true; + /* Wake up some event queue to handle event */ + getEventQueue(0)->wakeup(); } } diff -r 682695bc3ee7 -r 4eab81289ed0 src/python/swig/pyevent.cc --- a/src/python/swig/pyevent.cc Mon Sep 29 11:50:55 2014 +0100 +++ b/src/python/swig/pyevent.cc Mon Sep 29 11:51:37 2014 +0100 @@ -32,6 +32,7 @@ #include "python/swig/pyevent.hh" #include "sim/async.hh" +#include "sim/eventq.hh" PythonEvent::PythonEvent(PyObject *obj, Priority priority) : Event(priority), object(obj) @@ -59,6 +60,8 @@ // that there's been an exception. async_event = true; async_exception = true; + /* Wake up some event queue to handle event */ + getEventQueue(0)->wakeup(); } // Since the object has been removed from the event queue, its diff -r 682695bc3ee7 -r 4eab81289ed0 src/sim/eventq.hh --- a/src/sim/eventq.hh Mon Sep 29 11:50:55 2014 +0100 +++ b/src/sim/eventq.hh Mon Sep 29 11:51:37 2014 +0100 @@ -606,6 +606,21 @@ void handleAsyncInsertions(); /** + * Function to signal that the event loop should be woken up because + * an event has been scheduled by an agent outside the gem5 event + * loop(s) whose event insertion may not have been noticed by gem5. + * This function isn't needed by the usual gem5 event loop but may + * be necessary in derived EventQueues which host gem5 onto other + * schedulers. + * + * @param when Time of a delayed wakeup (if known). This parameter + * can be used by an implementation to schedule a wakeup in the + * future if it is sure it will remain active until then. + * Or it can be ignored and the event queue can be woken up now. + */ + virtual void wakeup(Tick when = (Tick)-1) { } + + /** * function for replacing the head of the event queue, so that a * different set of events can run without disturbing events that have * already been scheduled. Already scheduled events can be processed @@ -635,6 +650,8 @@ virtual void serialize(std::ostream &os); virtual void unserialize(Checkpoint *cp, const std::string §ion); #endif + + virtual ~EventQueue() { } }; void dumpMainQueue(); @@ -693,6 +710,11 @@ eventq->reschedule(event, when, always); } + void wakeupEventQueue(Tick when = (Tick)-1) + { + eventq->wakeup(when); + } + void setCurTick(Tick newVal) { eventq->setCurTick(newVal); } }; diff -r 682695bc3ee7 -r 4eab81289ed0 src/sim/init_signals.cc --- a/src/sim/init_signals.cc Mon Sep 29 11:50:55 2014 +0100 +++ b/src/sim/init_signals.cc Mon Sep 29 11:51:37 2014 +0100 @@ -48,6 +48,7 @@ #include "base/cprintf.hh" #include "sim/async.hh" #include "sim/core.hh" +#include "sim/eventq.hh" #include "sim/init_signals.hh" using namespace std; @@ -58,6 +59,8 @@ { async_event = true; async_statdump = true; + /* Wake up some event queue to handle event */ + getEventQueue(0)->wakeup(); } void @@ -66,6 +69,8 @@ async_event = true; async_statdump = true; async_statreset = true; + /* Wake up some event queue to handle event */ + getEventQueue(0)->wakeup(); } /// Exit signal handler. @@ -74,6 +79,8 @@ { async_event = true; async_exit = true; + /* Wake up some event queue to handle event */ + getEventQueue(0)->wakeup(); } /// Abort signal handler. @@ -89,6 +96,8 @@ { async_event = true; async_io = true; + /* Wake up some event queue to handle event */ + getEventQueue(0)->wakeup(); } static void