Skip to content

Commit 0553a05

Browse files
committed
On Win32, make minimum setitimer() sleep be 1ms, so sleeps < 1ms aren't
rounded down to zero. Backpatch to 8.1.X.
1 parent 64214a2 commit 0553a05

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/backend/port/win32/timer.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.10 2006/08/09 17:47:03 momjian Exp $
14+
* $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.11 2006/08/09 20:40:56 momjian Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -56,8 +56,14 @@ pg_timer_thread(LPVOID param)
5656
timerCommArea.value.it_value.tv_usec == 0)
5757
waittime = INFINITE; /* Cancel the interrupt */
5858
else
59+
{
60+
/* Minimum wait time is 1ms */
61+
if (timerCommArea.value.it_value.tv_sec == 0 &&
62+
timerCommArea.value.it_value.tv_usec < 1000)
63+
timerCommArea.value.it_value.tv_usec = 1000;
5964
/* WaitForSingleObjectEx() uses milliseconds */
6065
waittime = timerCommArea.value.it_value.tv_usec / 1000 + timerCommArea.value.it_value.tv_sec * 1000;
66+
}
6167
ResetEvent(timerCommArea.event);
6268
LeaveCriticalSection(&timerCommArea.crit_sec);
6369
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy