Re: Patch for Win32 blocking problem

From: Teodor Sigaev <teodor(at)sigaev(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch for Win32 blocking problem
Date: 2006-10-12 07:51:11
Message-ID: 452DF3EF.6010601@sigaev.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> time. I find the proposed patch in pgwin32_waitforsinglesocket to be a
> pretty ugly kluge though. Are you sure it's needed given the other fix?

Loop in pgwin32_send() doesn't prevent from infinite sleeping in
WaitForMultipleObjectEx in pgwin32_waitforsinglesocket. I'm not a Windows guru
at all, and I'm not like that part of patch too. I can't find better solution...

May be that way (untested):

if ( isUDP && (what & FP_WRITE) )
for(;;) {
r = WaitForMultipleObjects(100 ms);
if ( r == WAIT_TIMEOUT ) {
r == WSASend( sero packet ); /* see comments in pgwin32_select()
*/
[ analyze result of WSASend:
* if success then return 1
* WSAEWOULDBLOCK - continue loop
* SOCKET_ERROR - return 0
]
} else
break;
}

I'm not sure that is more clean way...

--
Teodor Sigaev E-mail: teodor(at)sigaev(dot)ru
WWW: http://www.sigaev.ru/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dawid Kuroczko 2006-10-12 07:52:11 GROUP BY on a large table -- an idea
Previous Message Marco Serantoni 2006-10-12 07:05:04 Re: Database Auditing