[Xcb] Win32 port - pls review

Jeetu Golani jeetu.golani at gmail.com
Wed Mar 31 09:45:43 PDT 2010


Hi Peter,

The redundant #ifndef _WIN32 inside USE_POLL has been taken off.

> You are correct that Winsock uses WSAEINTR instead, but Winsock also
> uses WSAGetLastError() instead of errno. So if we reset errno to 0
> before calling select, errno won't ever be EINTR, and the loop degrades
> gracefully into your no-loop case.

Yes this would work however if I understand you correctly we seem to have 
two choices :

a) xcb should initialize errno to 0 before calling select for all it's 
variants - *ix  and Win32.
b) we do a selective initialization of errno to 0 for Win32 - which would 
require the entire #ifdef mess we are trying to avoid. 

I'm all right with either solution so I guess it comes down to a vote as to 
what the rest of the devels think would be the right approach.

Bye for now

On Wednesday 31 March 2010, Peter Harris wrote:
> On 2010-03-31 00:36, Jeetu Golani wrote:
> >>> You appear to have accidentally dropped a number of headers in
> >>> xcb_util.c, including <fcntl.h> and <netinet/tcp.h>, so libxcb doesn't
> >>> compile any more on *ix.
> >
> > Ouch...sorry have included them back in the code.
> 
> Thanks.
> 
> >>> The do-while around select in xcb_in.c might not be required on Win32,
> >>> but does it hurt?
> >
> > Win32 doesn't have the EINTR error code flag and uses WSAEINTR 
instead
> > so we will have to #ifdef this region or change it somehow.
> 
> Win32 does have EINTR defined in <errno.h>
> 
> You are correct that Winsock uses WSAEINTR instead, but Winsock also
> uses WSAGetLastError() instead of errno. So if we reset errno to 0
> before calling select, errno won't ever be EINTR, and the loop degrades
> gracefully into your no-loop case.
> 
> Peter Harris
> 



More information about the Xcb mailing list