1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Restructure backend SIGINT/SIGTERM handling so that 'die' interrupts

are treated more like 'cancel' interrupts: the signal handler sets a
flag that is examined at well-defined spots, rather than trying to cope
with an interrupt that might happen anywhere.  See pghackers discussion
of 1/12/01.
This commit is contained in:
Tom Lane
2001-01-14 05:08:17 +00:00
parent 027f144e39
commit 36839c1927
24 changed files with 614 additions and 479 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: proc.h,v 1.33 2000/12/22 00:51:54 tgl Exp $
* $Id: proc.h,v 1.34 2001/01/14 05:08:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -22,9 +22,8 @@ extern int DeadlockTimeout;
typedef struct
{
int sleeplock;
IpcSemaphoreId semId;
int semNum;
IpcSemaphoreId semId; /* SysV semaphore set ID */
int semNum; /* semaphore number within set */
} SEMA;
/*
@ -38,12 +37,6 @@ struct proc
SEMA sem; /* ONE semaphore to sleep on */
int errType; /* error code tells why we woke up */
int critSects; /* If critSects > 0, we are in sensitive
* routines that cannot be recovered when
* the process fails. */
int prio; /* priority for sleep queue */
TransactionId xid; /* transaction currently being executed by
* this proc */
@ -72,6 +65,9 @@ struct proc
extern PROC *MyProc;
extern SPINLOCK ProcStructLock;
#define PROC_INCR_SLOCK(lock) \
do { \
if (MyProc) (MyProc->sLocks[(lock)])++; \
@ -89,11 +85,6 @@ do { \
#define ERR_TIMEOUT 1
#define ERR_BUFFER_IO 2
#define MAX_PRIO 50
#define MIN_PRIO (-1)
extern SPINLOCK ProcStructLock;
/*
* There is one ProcGlobal struct for the whole installation.
@ -142,5 +133,6 @@ extern int ProcLockWakeup(LOCKMETHOD lockmethod, LOCK *lock);
extern void ProcAddLock(SHM_QUEUE *elem);
extern void ProcReleaseSpins(PROC *proc);
extern void LockWaitCancel(void);
extern void HandleDeadLock(SIGNAL_ARGS);
#endif /* PROC_H */