+// ----------------------------------------------------------------------------
+// Helper class calling CheckSignal() on wake up
+// ----------------------------------------------------------------------------
+
+namespace
+{
+
+class SignalsWakeUpPipe : public wxWakeUpPipe
+{
+public:
+ // Ctor automatically registers this pipe with the event loop.
+ SignalsWakeUpPipe()
+ {
+ m_source = wxEventLoopBase::AddSourceForFD
+ (
+ GetReadFd(),
+ this,
+ wxEVENT_SOURCE_INPUT
+ );
+ }
+
+ virtual void OnReadWaiting()
+ {
+ // The base class wxWakeUpPipe::OnReadWaiting() needs to be called in order
+ // to read the data out of the wake up pipe and clear it for next time.
+ wxWakeUpPipe::OnReadWaiting();
+
+ if ( wxTheApp )
+ wxTheApp->CheckSignal();
+ }
+
+ virtual ~SignalsWakeUpPipe()
+ {
+ delete m_source;
+ }
+
+private:
+ wxEventLoopSource* m_source;
+};
+
+} // anonymous namespace
+
+wxAppConsole::wxAppConsole()
+{
+ m_signalWakeUpPipe = NULL;
+}
+
+wxAppConsole::~wxAppConsole()
+{
+ delete m_signalWakeUpPipe;
+}
+