#include "wx/sckaddr.h"
#include "wx/socket.h"
-// GRG: Why is this needed?
-#ifdef __WXGTK__
+#if defined(__WXMSW__) || defined(__WXPM__)
+#define PROCESS_EVENTS() wxYield()
+#elif defined(__WXGTK__)
#include <gtk/gtk.h>
-#define wxYield() gtk_main_iteration()
-#endif
+#define PROCESS_EVENTS() gtk_main_iteration()
+#endif
+
// --------------------------------------------------------------
// ClassInfos
DoDefer();
}
- // Wait for buffer completion.
+ // Wait for buffer completion.
while (m_defer_buffer != NULL)
- wxYield();
+ PROCESS_EVENTS();
timer.Stop();
// If the socket is not connected, or we have got the whole
// needed buffer, return immedately
- if (!m_connected || !m_socket || !nbytes)
+ if (!m_connected || !m_socket || !nbytes)
return total;
// Possible combinations (they are checked in this order)
// NOWAIT
// SPEED | WAITALL
- // SPEED
+ // SPEED
// WAITALL
// NONE
//
if (sig != 0xfeeddead)
{
- wxLogMessage(_T("Warning: invalid signature returned to ReadMsg"));
+ wxLogMessage(wxT("Warning: invalid signature returned to ReadMsg"));
goto exit;
}
if (sig != 0xdeadfeed)
{
- //wxLogMessage(_T("Warning: invalid signature returned to ReadMsg"));
+ //wxLogMessage(wxT("Warning: invalid signature returned to ReadMsg"));
goto exit;
}
DoDefer();
}
- // Wait for buffer completion.
+ // Wait for buffer completion.
while (m_defer_buffer != NULL)
- wxYield();
+ PROCESS_EVENTS();
timer.Stop();
// Possible combinations (they are checked in this order)
// NOWAIT
// SPEED | WAITALL
- // SPEED
+ // SPEED
// WAITALL
// NONE
//
// TODO: TriggerRead
return *this;
-
+
#undef MAX_BUFSIZE
}
// they poll the socket, using GSocket_Select(), to check for
// the specified combination of event flags, until an event
// occurs or until the timeout ellapses. The polling loop
-// calls wxYield(), so this won't block the GUI.
+// calls PROCESS_EVENTS(), so this won't block the GUI.
bool wxSocketBase::_Wait(long seconds, long milliseconds, wxSocketEventFlags flags)
{
}
if (timeout != 0)
- wxYield();
+ PROCESS_EVENTS();
}
while ((state == -1) && timeout);
{
m_flags = _flags;
}
-
+
// --------------------------------------------------------------
// wxSocketBase callback management
// --------------------------------------------------------------