From c77a29a14efe69851a087989e3520ed560fa8862 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 6 Oct 1998 02:40:09 +0000 Subject: Substantial rewrite of async.c to avoid problems with non-reentrant stdio and possibly other problems. Minor changes in xact.c and postgres.c's main loop to support new handling of async NOTIFY. --- src/backend/tcop/postgres.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 566b15c5b0d..8394fcdea77 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.90 1998/10/02 01:14:14 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.91 1998/10/06 02:40:01 tgl Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -1511,7 +1511,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) if (!IsUnderPostmaster) { puts("\nPOSTGRES backend interactive interface "); - puts("$Revision: 1.90 $ $Date: 1998/10/02 01:14:14 $\n"); + puts("$Revision: 1.91 $ $Date: 1998/10/06 02:40:01 $\n"); } /* ---------------- @@ -1559,7 +1559,16 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ReadyForQuery(whereToSendOutput); /* ---------------- - * (2) read a command. + * (2) deal with pending asynchronous NOTIFY from other backends, + * and enable async.c's signal handler to execute NOTIFY directly. + * ---------------- + */ + QueryCancel = false; /* forget any earlier CANCEL signal */ + + EnableNotifyInterrupt(); + + /* ---------------- + * (3) read a command. * ---------------- */ MemSet(parser_input, 0, MAX_PARSE_BUFFER); @@ -1569,7 +1578,13 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) QueryCancel = false; /* forget any earlier CANCEL signal */ /* ---------------- - * (3) process the command. + * (4) disable async.c's signal handler. + * ---------------- + */ + DisableNotifyInterrupt(); + + /* ---------------- + * (5) process the command. * ---------------- */ switch (firstchar) @@ -1640,7 +1655,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) } /* ---------------- - * (4) commit the current transaction + * (6) commit the current transaction * * Note: if we had an empty input buffer, then we didn't * call pg_exec_query, so we don't bother to commit this transaction. -- cgit v1.2.3