Fix statement_timeout on Win32 so that it properly treats micro-seconds
authorBruce Momjian <bruce@momjian.us>
Wed, 9 Aug 2006 17:47:06 +0000 (17:47 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 9 Aug 2006 17:47:06 +0000 (17:47 +0000)
as micro-seconds, rather than as 100 microseconds, as it does now.  This
actually fixes all setitimer calls on Win32, but statement_timeout is
the most visible fix.

Backpatch to 8.1.X.  8.0 works as documented.

src/backend/port/win32/timer.c

index 778e16102dc5fcfb22c8b62cc34dc0904525c4ea..b8f1e8bd686e11aee9ac1764ab3ce8c6f9c25345 100644 (file)
@@ -56,7 +56,8 @@ pg_timer_thread(LPVOID param)
                                timerCommArea.value.it_value.tv_usec == 0)
                                waittime = INFINITE;    /* Cancel the interrupt */
                        else
-                               waittime = timerCommArea.value.it_value.tv_usec / 10 + timerCommArea.value.it_value.tv_sec * 1000;
+                               /* WaitForSingleObjectEx() uses milliseconds */
+                               waittime = timerCommArea.value.it_value.tv_usec / 1000 + timerCommArea.value.it_value.tv_sec * 1000;
                        ResetEvent(timerCommArea.event);
                        LeaveCriticalSection(&timerCommArea.crit_sec);
                }