1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Round microseconds on setitimer upwards.

This commit is contained in:
Bruce Momjian
2006-08-09 21:18:15 +00:00
parent 83b27b9180
commit a42c545f62

View File

@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.6.2.3 2006/08/09 20:41:07 momjian Exp $ * $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.6.2.4 2006/08/09 21:18:15 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -57,12 +57,9 @@ pg_timer_thread(LPVOID param)
waittime = INFINITE; /* Cancel the interrupt */ waittime = INFINITE; /* Cancel the interrupt */
else else
{ {
/* Minimum wait time is 1ms */ /* WaitForSingleObjectEx() uses milliseconds, round up */
if (timerCommArea.value.it_value.tv_sec == 0 && waittime = (timerCommArea.value.it_value.tv_usec + 999) / 1000 +
timerCommArea.value.it_value.tv_usec < 1000) timerCommArea.value.it_value.tv_sec * 1000;
timerCommArea.value.it_value.tv_usec = 1000;
/* WaitForSingleObjectEx() uses milliseconds */
waittime = timerCommArea.value.it_value.tv_usec / 1000 + timerCommArea.value.it_value.tv_sec * 1000;
} }
ResetEvent(timerCommArea.event); ResetEvent(timerCommArea.event);
LeaveCriticalSection(&timerCommArea.crit_sec); LeaveCriticalSection(&timerCommArea.crit_sec);