wx/meta/if.h \
wx/meta/int2type.h \
wx/meta/movable.h \
- wx/private/fdiodispatcher.h \
- wx/private/selectdispatcher.h \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
src/osx/core/utilsexc_base.cpp
@COND_TOOLKIT_X11@BASE_OSX_SRC = $(COND_TOOLKIT_X11_BASE_OSX_SRC)
COND_TOOLKIT__BASE_OSX_HDR = \
- wx/private/fdiodispatcher.h \
- wx/private/selectdispatcher.h \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/osx/core/private/strconv_cf.h
@COND_TOOLKIT_@BASE_OSX_HDR = $(COND_TOOLKIT__BASE_OSX_HDR)
COND_TOOLKIT_COCOA_BASE_OSX_HDR = \
- wx/private/fdiodispatcher.h \
- wx/private/selectdispatcher.h \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/osx/core/private/strconv_cf.h
@COND_TOOLKIT_COCOA@BASE_OSX_HDR = $(COND_TOOLKIT_COCOA_BASE_OSX_HDR)
COND_TOOLKIT_GTK_BASE_OSX_HDR = \
- wx/private/fdiodispatcher.h \
- wx/private/selectdispatcher.h \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/osx/core/private/strconv_cf.h
@COND_TOOLKIT_GTK@BASE_OSX_HDR = $(COND_TOOLKIT_GTK_BASE_OSX_HDR)
COND_TOOLKIT_MOTIF_BASE_OSX_HDR = \
- wx/private/fdiodispatcher.h \
- wx/private/selectdispatcher.h \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/osx/core/private.h \
wx/osx/core/stdpaths.h \
wx/osx/core/private/strconv_cf.h \
- wx/private/fdiodispatcher.h \
- wx/private/selectdispatcher.h \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/osx/core/private.h \
wx/osx/core/stdpaths.h \
wx/osx/core/private/strconv_cf.h \
- wx/private/fdiodispatcher.h \
- wx/private/selectdispatcher.h \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/unix/tls.h
@COND_TOOLKIT_OSX_COCOA@BASE_OSX_HDR = $(COND_TOOLKIT_OSX_COCOA_BASE_OSX_HDR)
COND_TOOLKIT_X11_BASE_OSX_HDR = \
- wx/private/fdiodispatcher.h \
- wx/private/selectdispatcher.h \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
wx/os2/wxrsc.h
@COND_PLATFORM_OS2_1@BASE_PLATFORM_HDR = $(COND_PLATFORM_OS2_1_BASE_PLATFORM_HDR)
COND_PLATFORM_UNIX_1_BASE_PLATFORM_HDR = \
- wx/private/fdiodispatcher.h \
- wx/private/selectdispatcher.h \
wx/unix/app.h \
wx/unix/apptbase.h \
wx/unix/apptrait.h \
</set>
<set var="BASE_UNIX_AND_DARWIN_HDR" hints="files">
- wx/private/fdiodispatcher.h
- wx/private/selectdispatcher.h
wx/unix/app.h
wx/unix/apptbase.h
wx/unix/apptrait.h
#if wxUSE_CONSOLE_EVENTLOOP
-#include "wx/private/fdiodispatcher.h"
-#include "wx/unix/pipe.h"
-
// ----------------------------------------------------------------------------
-// wxEventLoop
+// wxConsoleEventLoop
// ----------------------------------------------------------------------------
+class wxFDIODispatcher;
+
+namespace wxPrivate
+{
+ class PipeIOHandler;
+};
+
class WXDLLIMPEXP_BASE wxConsoleEventLoop : public wxEventLoopManual
{
public:
// initialize the event loop, use IsOk() to check if we were successful
wxConsoleEventLoop();
+ virtual ~wxConsoleEventLoop();
// implement base class pure virtuals
virtual bool Pending() const;
private:
// pipe used for wake up messages: when a child thread wants to wake up
// the event loop in the main thread it writes to this pipe
- class PipeIOHandler : public wxFDIOHandler
- {
- public:
- // default ctor does nothing, call Create() to really initialize the
- // object
- PipeIOHandler() { }
-
- bool Create();
-
- // this method can be, and normally is, called from another thread
- void WakeUp();
-
- int GetReadFd() { return m_pipe[wxPipe::Read]; }
-
- // implement wxFDIOHandler pure virtual methods
- virtual void OnReadWaiting();
- virtual void OnWriteWaiting() { }
- virtual void OnExceptionWaiting() { }
-
- private:
- wxPipe m_pipe;
- };
-
- PipeIOHandler m_wakeupPipe;
+ wxPrivate::PipeIOHandler *m_wakeupPipe;
// either wxSelectDispatcher or wxEpollDispatcher
wxFDIODispatcher *m_dispatcher;
#include "wx/evtloop.h"
#include "wx/thread.h"
#include "wx/module.h"
+#include "wx/unix/pipe.h"
#include "wx/unix/private/timer.h"
#include "wx/unix/private/epolldispatcher.h"
#include "wx/private/selectdispatcher.h"
// wxEventLoop::PipeIOHandler implementation
// ===========================================================================
+namespace wxPrivate
+{
+
+// pipe used for wake up messages: when a child thread wants to wake up
+// the event loop in the main thread it writes to this pipe
+class PipeIOHandler : public wxFDIOHandler
+{
+public:
+ // default ctor does nothing, call Create() to really initialize the
+ // object
+ PipeIOHandler() { }
+
+ bool Create();
+
+ // this method can be, and normally is, called from another thread
+ void WakeUp();
+
+ int GetReadFd() { return m_pipe[wxPipe::Read]; }
+
+ // implement wxFDIOHandler pure virtual methods
+ virtual void OnReadWaiting();
+ virtual void OnWriteWaiting() { }
+ virtual void OnExceptionWaiting() { }
+
+private:
+ wxPipe m_pipe;
+};
+
// ----------------------------------------------------------------------------
// initialization
// ----------------------------------------------------------------------------
-bool wxConsoleEventLoop::PipeIOHandler::Create()
+bool PipeIOHandler::Create()
{
if ( !m_pipe.Create() )
{
// wakeup handling
// ----------------------------------------------------------------------------
-void wxConsoleEventLoop::PipeIOHandler::WakeUp()
+void PipeIOHandler::WakeUp()
{
if ( write(m_pipe[wxPipe::Write], "s", 1) != 1 )
{
}
}
-void wxConsoleEventLoop::PipeIOHandler::OnReadWaiting()
+void PipeIOHandler::OnReadWaiting()
{
// got wakeup from child thread: read all data available in pipe just to
// make it empty (even though we write one byte at a time from WakeUp(),
// else needs to be done
}
+} // namespace wxPrivate
+
// ===========================================================================
// wxEventLoop implementation
// ===========================================================================
wxConsoleEventLoop::wxConsoleEventLoop()
{
- if ( !m_wakeupPipe.Create() )
+ m_wakeupPipe = new wxPrivate::PipeIOHandler();
+ if ( !m_wakeupPipe->Create() )
{
+ wxDELETE(m_wakeupPipe);
m_dispatcher = NULL;
return;
}
m_dispatcher->RegisterFD
(
- m_wakeupPipe.GetReadFd(),
- &m_wakeupPipe,
+ m_wakeupPipe->GetReadFd(),
+ m_wakeupPipe,
wxFDIO_INPUT
);
}
+wxConsoleEventLoop::~wxConsoleEventLoop()
+{
+ delete m_wakeupPipe;
+}
+
//-----------------------------------------------------------------------------
// events dispatch and loop handling
//-----------------------------------------------------------------------------
void wxConsoleEventLoop::WakeUp()
{
- m_wakeupPipe.WakeUp();
+ m_wakeupPipe->WakeUp();
}
void wxConsoleEventLoop::OnNextIteration()