1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-21 10:42:50 +03:00

In a Windows backend, don't build src/port/pgsleep.c's version of

pg_usleep at all.  Instead call the replacement function in
port/win32/signal.c by that name.  Avoids tricky macro-redefinition
logic and suppresses a compiler warning; furthermore it ensures that
no one can accidentally use the non-signal-aware version of pg_usleep
in a Windows backend.
This commit is contained in:
Tom Lane
2006-07-16 20:17:04 +00:00
parent e96373aae5
commit 93120f3501
4 changed files with 24 additions and 16 deletions

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/port/win32/signal.c,v 1.16 2006/03/05 15:58:35 momjian Exp $
* $PostgreSQL: pgsql/src/backend/port/win32/signal.c,v 1.17 2006/07/16 20:17:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,11 +41,19 @@ static pqsigfunc pg_signal_defaults[PG_SIGNAL_COUNT];
static DWORD WINAPI pg_signal_thread(LPVOID param);
static BOOL WINAPI pg_console_handler(DWORD dwCtrlType);
/* Sleep function that can be interrupted by signals */
/*
* pg_usleep --- delay the specified number of microseconds, but
* stop waiting if a signal arrives.
*
* This replaces the non-signal-aware version provided by src/port/pgsleep.c.
*/
void
pgwin32_backend_usleep(long microsec)
pg_usleep(long microsec)
{
if (WaitForSingleObject(pgwin32_signal_event, (microsec < 500 ? 1 : (microsec + 500) / 1000)) == WAIT_OBJECT_0)
if (WaitForSingleObject(pgwin32_signal_event,
(microsec < 500 ? 1 : (microsec + 500) / 1000))
== WAIT_OBJECT_0)
{
pgwin32_dispatch_queued_signals();
errno = EINTR;

View File

@@ -18,7 +18,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.27 2006/07/11 18:26:10 momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.28 2006/07/16 20:17:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -348,7 +348,7 @@ SysLoggerMain(int argc, char *argv[])
* detect pipe EOF. The main thread just wakes up once a second to
* check for SIGHUP and rotation conditions.
*/
pgwin32_backend_usleep(1000000);
pg_usleep(1000000L);
#endif /* WIN32 */
if (pipe_eof_seen)