From 43bf3a6bc658d634e073dcb4ea3580dd9053a3b1 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 23 Aug 2005 21:02:05 +0000 Subject: The attached patch updates the thread test program to run stand-alone on Windows. The test itself is bypassed in configure as discussed, and libpq has been updated appropriately to allow it to build in thread-safe mode. Dave Page --- src/interfaces/libpq/fe-print.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/interfaces/libpq/fe-print.c') diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c index 38bc1ceee6c..a83004328c1 100644 --- a/src/interfaces/libpq/fe-print.c +++ b/src/interfaces/libpq/fe-print.c @@ -10,7 +10,7 @@ * didn't really belong there. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.62 2005/08/23 20:48:47 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.63 2005/08/23 21:02:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -88,7 +88,7 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po) int total_line_length = 0; int usePipe = 0; char *pagerenv; -#ifdef ENABLE_THREAD_SAFETY +#if defined(ENABLE_THREAD_SAFETY) && !defined(WIN32) sigset_t osigset; bool sigpipe_masked = false; bool sigpipe_pending; @@ -189,14 +189,14 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po) if (fout) { usePipe = 1; +#ifndef WIN32 #ifdef ENABLE_THREAD_SAFETY if (pq_block_sigpipe(&osigset, &sigpipe_pending) == 0) sigpipe_masked = true; #else -#ifndef WIN32 oldsigpipehandler = pqsignal(SIGPIPE, SIG_IGN); -#endif -#endif +#endif /* ENABLE_THREAD_SAFETY */ +#endif /* WIN32 */ } else fout = stdout; @@ -311,16 +311,15 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po) _pclose(fout); #else pclose(fout); -#endif + #ifdef ENABLE_THREAD_SAFETY /* we can't easily verify if EPIPE occurred, so say it did */ if (sigpipe_masked) pq_reset_sigpipe(&osigset, sigpipe_pending, true); #else -#ifndef WIN32 pqsignal(SIGPIPE, oldsigpipehandler); -#endif -#endif +#endif /* ENABLE_THREAD_SAFETY */ +#endif /* WIN32 */ } if (po->html3 && !po->expanded) fputs("\n", fout); -- cgit v1.2.3