From acd27bc1f7a831514cf021a44c10cad1977066dc Mon Sep 17 00:00:00 2001 From: caro Date: Sun, 8 Nov 2009 22:14:48 +0000 Subject: [PATCH] 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 git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@43547 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore/ecore_main.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c index 54770e0..7768c81 100644 --- a/src/lib/ecore/ecore_main.c +++ b/src/lib/ecore/ecore_main.c @@ -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)) -- 2.7.4