+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;
+}
+
+// use unusual names for arg[cv] to avoid clashes with wxApp members with the
+// same names
+bool wxAppConsole::Initialize(int& argc_, wxChar** argv_)
+{
+ if ( !wxAppConsoleBase::Initialize(argc_, argv_) )