mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Disable elog(ERROR|FATAL) in signal handlers in
critical sections of code.
This commit is contained in:
@@ -7,13 +7,15 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: elog.h,v 1.18 2000/06/04 15:06:34 petere Exp $
|
||||
* $Id: elog.h,v 1.19 2000/12/03 10:27:29 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef ELOG_H
|
||||
#define ELOG_H
|
||||
|
||||
#include "miscadmin.h"
|
||||
|
||||
#define NOTICE 0 /* random info - no special action */
|
||||
#define ERROR (-1) /* user error - return to known state */
|
||||
#define FATAL 1 /* fatal error - abort process */
|
||||
@@ -27,6 +29,25 @@
|
||||
extern int Use_syslog;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If StopIfError > 0 signal handlers don't do
|
||||
* elog(ERROR|FATAL) but remember what action was
|
||||
* required with QueryCancel & ExitAfterAbort
|
||||
*/
|
||||
extern bool ExitAfterAbort;
|
||||
#define START_CRIT_CODE StopIfError++
|
||||
#define END_CRIT_CODE \
|
||||
if (!StopIfError)\
|
||||
elog(STOP, "Not in critical section");\
|
||||
StopIfError--;\
|
||||
if (!StopIfError && QueryCancel)\
|
||||
{\
|
||||
if (ExitAfterAbort)\
|
||||
elog(FATAL, "The system is shutting down");\
|
||||
else\
|
||||
elog(ERROR, "Query was cancelled.");\
|
||||
}
|
||||
|
||||
extern bool Log_timestamp;
|
||||
extern bool Log_pid;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user