From: | "Magnus Hagander" <mha(at)sollentuna(dot)net> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Claudio Natoli" <claudio(dot)natoli(at)memetrics(dot)com> |
Cc: | <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: APC/socket fix (final?) |
Date: | 2004-03-25 19:41:35 |
Message-ID: | 6BCB9D8A16AC4241919521715F4D8BCE34B5DF@algol.sollentuna.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
>Claudio Natoli <claudio(dot)natoli(at)memetrics(dot)com> writes:
>> + #ifdef WIN32
>> + /* Interrupted by socket/APC interaction? */
>> + if (n < 0 && GetLastError() == ERROR_IO_PENDING)
>> + errno = EINTR;
>> + #endif
>
>This seems a bit schizophrenic; if you can assign to errno,
>why can't you
>read from it? Would look more consistent if the code looked like
>
> if (n < 0 && errno == ERROR_IO_PENDING)
> errno = EINTR;
>
The problem is that winsock does not *set* the errno variable in the
case when it's interrupted by an APC. errno is left at 0.
GetLastError() is the win32 replacement for errno. In most cases errno
is set correctly when you use the "unix api functions", but not in this
case (which is arguably a bug, but it's there nevertheless). If you use
"native win32 functions", you get GetLastError() set only.
//Magnus
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2004-03-25 20:58:51 | Re: installdir patch for win32 |
Previous Message | Andrew Dunstan | 2004-03-25 18:57:25 | Re: installdir patch for win32 |