On Thu, Aug 30, 2012 at 9:20 PM, HariHara Sudhan <h...@emo2.com> wrote:
> MsgWaitForMultipleObjects is returning WAIT_FAILED which  prints
> error  like "_ecore_main_win32_select failed "
> and few random characters, and this same error is printed about 50 times on
> the console after which the program exits.
> I'm downloading multiple image files in the background and loading them on
> to the canvas. This works for a while  and then the error appears randomly.
> I'm using ecore-1.1.0 and not the latest version yet. Any help is
> appreciated.
> FYI I changed a few lines in the below function.

which lines ? Provide a diff, please

Vincent

>
> static int
> _ecore_main_win32_select(int             nfds __UNUSED__,
>                          fd_set         *readfds,
>                          fd_set         *writefds,
>                          fd_set         *exceptfds,
>                          struct timeval *tv)
> {
>    HANDLE objects[MAXIMUM_WAIT_OBJECTS];
>    int sockets[MAXIMUM_WAIT_OBJECTS];
>    Ecore_Fd_Handler *fdh;
>    Ecore_Win32_Handler *wh;
>    unsigned int objects_nbr = 0;
>    unsigned int handles_nbr = 0;
>    unsigned int events_nbr = 0;
>    DWORD result;
>    DWORD timeout;
>    MSG msg;
>    unsigned int i;
>    int res;
>
>    /* Create an event object per socket */
>    EINA_INLIST_FOREACH(fd_handlers, fdh)
>      {
>         WSAEVENT event;
>         long network_event;
>
>         network_event = 0;
>         if (readfds)
>           {
>         if (FD_ISSET(fdh->fd, readfds))
>           network_event |= FD_READ;
>           }
>         if (writefds)
>           {
>         if (FD_ISSET(fdh->fd, writefds))
>           network_event |= FD_WRITE;
>           }
>         if (exceptfds)
>           {
>         if (FD_ISSET(fdh->fd, exceptfds))
>           network_event |= FD_OOB;
>           }
>
>         if (network_event)
>           {
>              event = WSACreateEvent();
>              WSAEventSelect(fdh->fd, event, network_event);
>              objects[objects_nbr] = event;
>              sockets[events_nbr] = fdh->fd;
>              events_nbr++;
>              objects_nbr++;
>           }
>      }
>
>    /* store the HANDLEs in the objects to wait for */
>    EINA_INLIST_FOREACH(win32_handlers, wh)
>      {
>         objects[objects_nbr] = wh->h;
>         handles_nbr++;
>         objects_nbr++;
>      }
>
>    /* Empty the queue before waiting */
>    while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
>      {
>         TranslateMessage(&msg);
>         DispatchMessage(&msg);
>      }
>
>    /* Wait for any message sent or posted to this queue */
>    /* or for one of the passed handles be set to signaled. */
>    if (!tv)
>      timeout = INFINITE;
>    else
>      timeout = (DWORD)((tv->tv_sec * 1000.0) + (tv->tv_usec / 1000.0));
>
>    if (timeout == 0) return 0;
>
>    result = MsgWaitForMultipleObjects(objects_nbr, (const HANDLE *)objects,
> EINA_FALSE,
>                                       timeout, QS_ALLINPUT);
>
>    if (readfds)
>    FD_ZERO(readfds);
>    if (writefds)
>    FD_ZERO(writefds);
>    if (exceptfds)
>    FD_ZERO(exceptfds);
>
>    /* The result tells us the type of event we have. */
>    if (result == WAIT_FAILED)
>      {
>         char *m;
>
>         m = evil_last_error_get();
>         ERR("%s", m);
>         free(m);
>         res = -1;
>      }
>    else if (result == WAIT_TIMEOUT)
>      {
>         /* ERR("time out\n"); */
>          res = 0;
>      }
>    else if (result == (WAIT_OBJECT_0 + objects_nbr))
>      {
>         while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
>           {
>              TranslateMessage(&msg);
>              DispatchMessage(&msg);
>           }
>
>         res = 0;
>      }
>    else if ((result >= 0) && (result < WAIT_OBJECT_0 + events_nbr))
>      {
>         WSANETWORKEVENTS network_event;
>
>         WSAEnumNetworkEvents(sockets[result], objects[result],
> &network_event);
>
>         if ((network_event.lNetworkEvents & FD_READ) && readfds)
>           FD_SET(sockets[result], readfds);
>         if ((network_event.lNetworkEvents & FD_WRITE) && writefds)
>           FD_SET(sockets[result], writefds);
>         if ((network_event.lNetworkEvents & FD_OOB) && exceptfds)
>           FD_SET(sockets[result], exceptfds);
>
>         res = 1;
>      }
>    else if ((result >= (WAIT_OBJECT_0 + events_nbr)) &&
>             (result < (WAIT_OBJECT_0 + objects_nbr)))
>      {
>         if (!win32_handler_current)
>           {
>              /* regular main loop, start from head */
>               win32_handler_current = win32_handlers;
>           }
>         else
>           {
>              /* recursive main loop, continue from where we were */
>               win32_handler_current = (Ecore_Win32_Handler
> *)EINA_INLIST_GET(win32_handler_current)->next;
>           }
>
>         while (win32_handler_current)
>           {
>              wh = win32_handler_current;
>
>              if (objects[result - WAIT_OBJECT_0] == wh->h)
>                {
>                   if (!wh->delete_me)
>                     {
>                        wh->references++;
>                        if (!wh->func(wh->data, wh))
>                          {
>                             wh->delete_me = EINA_TRUE;
>                             win32_handlers_delete_me = EINA_TRUE;
>                          }
>                        wh->references--;
>                     }
>                }
>              if (win32_handler_current) /* may have changed in recursive
> main loops */
>                win32_handler_current = (Ecore_Win32_Handler
> *)EINA_INLIST_GET(win32_handler_current)->next;
>           }
>         res = 1;
>      }
>    else
>      {
>         ERR("unknown result...\n");
>         res = -1;
>      }
>
>    /* Remove event objects again */
>    for (i = 0; i < events_nbr; i++) WSACloseEvent(objects[i]);
>
>    return res;
> }
>
>
> --
> Regards
>
> HariHaraSudhan
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to