Fixes for the Win32 port:

* if ecore_events are in the queue, timeout 0 is passed and
   MsgWaitForMultipleObjects returns immediately, which can
   lead to problems. If timeout is 0, we do nothing (that is,
   we wait for the ecore_events to finish first)
 * manage the case when MsgWaitForMultipleObjects returns WAIT_FAILED

SVN revision: 43547
This commit is contained in:
Vincent Torri 2009-11-08 22:14:48 +00:00
parent f6b7273237
commit a6713c7af1
1 changed files with 14 additions and 2 deletions

View File

@ -438,7 +438,7 @@ _ecore_main_select(double timeout)
if (ret < 0)
{
#ifdef _WIN32
fprintf(stderr, "main_loop_select error %d\n", WSAGetLastError());
fprintf(stderr, "main_loop_select error %d\n", WSAGetLastError());
if (WSAEINTR == WSAGetLastError()) return -1;
#else
if (errno == EINTR) return -1;
@ -799,6 +799,8 @@ _ecore_main_win32_select(int nfds, fd_set *readfds, fd_set *writefds,
else
timeout = (DWORD)(tv->tv_sec * 1000.0 + tv->tv_usec / 1000.0);
if (timeout == 0) return;
result = MsgWaitForMultipleObjects(objects_nbr, (const HANDLE *)objects, FALSE,
timeout, QS_ALLINPUT);
@ -807,8 +809,18 @@ _ecore_main_win32_select(int nfds, fd_set *readfds, fd_set *writefds,
FD_ZERO(exceptfds);
/* The result tells us the type of event we have. */
if (result == WAIT_TIMEOUT)
if (result == WAIT_FAILED)
{
char *msg;
msg = evil_last_error_get();
printf (" * %s\n", msg);
free(msg);
res = 0;
}
else if (result == WAIT_TIMEOUT)
{
printf ("time out\n");
res = 0;
}
else if (result == (WAIT_OBJECT_0 + objects_nbr))