-// --------------------------------------------------------------
-// --------- wxSocketBase wait functions ------------------------
-// --------------------------------------------------------------
-
-static void wx_socket_wait(GSocket *socket, GSocketEvent event, char *cdata)
-{
- int *state = (int *)cdata;
-
- *state = event;
-}
-
-bool wxSocketBase::_Wait(long seconds, long milliseconds, int type)
-{
- bool old_notify_state = m_notify_state;
- int state = -1;
- _wxSocketInternalTimer timer;
-
- if (!m_connected || !m_socket)
- return FALSE;
-
- // Set the variable to change
- timer.m_state = &state;
- timer.m_new_val = GSOCK_MAX_EVENT;
-
- // Disable the previous handler
- Notify(FALSE);
-
- // Set the timeout
- timer.Start(seconds * 1000 + milliseconds, TRUE);
- GSocket_SetCallback(m_socket, type, wx_socket_wait, (char *)&state);
-
- while (state == -1)
- wxYield();
-
- GSocket_UnsetCallback(m_socket, type);
- timer.Stop();
-
- // Notify will restore automatically the old GSocket flags
- Notify(old_notify_state);
-
- return (state != GSOCK_MAX_EVENT);
-}