1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Here is a patch that implements setitimer() on win32. With this patch

applied, deadlock detection and statement_timeout now works.

The file timer.c goes into src/backend/port/win32/.

The patch also removes two lines of "printf debugging" accidentally left
in pqsignal.h, in the console control handler.

Magnus Hagander
This commit is contained in:
Bruce Momjian
2004-02-18 16:25:12 +00:00
parent f8257734e4
commit af3b182a57
5 changed files with 79 additions and 20 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.146 2004/02/08 22:28:56 neilc Exp $
* $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.147 2004/02/18 16:25:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -972,9 +972,6 @@ ProcSendSignal(BackendId procId)
bool
enable_sig_alarm(int delayms, bool is_statement_timeout)
{
#ifdef WIN32
#warning add Win32 timer
#else
struct timeval fin_time;
#ifndef __BEOS__
@ -1044,7 +1041,6 @@ enable_sig_alarm(int delayms, bool is_statement_timeout)
time_interval = delayms * 1000; /* usecs */
if (set_alarm(time_interval, B_ONE_SHOT_RELATIVE_ALARM) < 0)
return false;
#endif
#endif
return true;
}
@ -1059,10 +1055,6 @@ enable_sig_alarm(int delayms, bool is_statement_timeout)
bool
disable_sig_alarm(bool is_statement_timeout)
{
#ifdef WIN32
#warning add Win32 timer
#else
/*
* Always disable the interrupt if it is active; this avoids being
* interrupted by the signal handler and thereby possibly getting
@ -1102,7 +1094,6 @@ disable_sig_alarm(bool is_statement_timeout)
if (!CheckStatementTimeout())
return false;
}
#endif
return true;
}
@ -1135,9 +1126,6 @@ CheckStatementTimeout(void)
else
{
/* Not time yet, so (re)schedule the interrupt */
#ifdef WIN32
#warning add win32 timer
#else
#ifndef __BEOS__
struct itimerval timeval;
@ -1160,7 +1148,6 @@ CheckStatementTimeout(void)
(statement_fin_time.tv_usec - now.tv_usec);
if (set_alarm(time_interval, B_ONE_SHOT_RELATIVE_ALARM) < 0)
return false;
#endif
#endif
}