EINTR vs. WSAEINTR

Shachar Shemesh wine-devel at shemesh.biz
Sun Sep 5 09:15:37 CDT 2004


Hi list,

When calling "select" (or any other socket function, for that purpose), 
there is a chance that a signal will arrive while we are blocking on the 
socket. This will cause the blocking function to return with EINTR. The 
usual recommendation is to retry the operation if that is the case.

http://www.wlug.org.nz/EINTR

Our current behavior, at least in "WS_select", is to convert it to 
WSAEINTR, and return the error. I think this behavior is wrong.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/windows_sockets_error_codes_2.asp

MSDN says that WSAEINTR is only returned if WSACancelBlockingCall is 
received during the wait. I have a program for which I can affect the 
source that fails because of a select call being interrupted. I'm 
wondering whether it's better to fix the program to retry on WSAEINTR, 
or to fix wine. One possible fix to Wine is to mask all signals right 
before calling "select", and restore the signal mask when returning. 
This will ensure that EINTR will not be received.

Can someone more versed in winsock voice an opinion about whether this 
is indeed a problem in Wine?

                Shachar




More information about the wine-devel mailing list