From 989f530d3f793ed1c990d705d0958bfd2a533b85 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 10 Aug 2011 12:20:45 -0400 Subject: Back-patch assorted latch-related fixes. Fix a whole bunch of signal handlers that had been hacked to do things that might change errno, without adding the necessary save/restore logic for errno. Also make some minor fixes in unix_latch.c, and clean up bizarre and unsafe scheme for disowning the process's latch. While at it, rename the PGPROC latch field to procLatch for consistency with 9.2. Issues noted while reviewing a patch by Peter Geoghegan. --- src/backend/tcop/postgres.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/backend/tcop/postgres.c') diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index f035a48e9b4..660a67412dc 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -2643,11 +2643,12 @@ die(SIGNAL_ARGS) InterruptHoldoffCount--; ProcessInterrupts(); } - - /* Interrupt any sync rep wait which is currently in progress. */ - SetLatch(&(MyProc->waitLatch)); } + /* If we're still here, waken anything waiting on the process latch */ + if (MyProc) + SetLatch(&MyProc->procLatch); + errno = save_errno; } @@ -2684,11 +2685,12 @@ StatementCancelHandler(SIGNAL_ARGS) InterruptHoldoffCount--; ProcessInterrupts(); } - - /* Interrupt any sync rep wait which is currently in progress. */ - SetLatch(&(MyProc->waitLatch)); } + /* If we're still here, waken anything waiting on the process latch */ + if (MyProc) + SetLatch(&MyProc->procLatch); + errno = save_errno; } -- cgit v1.2.3