diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-12 21:54:01 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-01-12 21:54:01 +0000 |
commit | 6162432de9fb023b710c171f196e27b910e45fa7 (patch) | |
tree | 51bba2e60ca2d3497b365b23edd52d52574faae2 /src/backend/commands/sequence.c | |
parent | be8477bc3718a05b02dd7e9f8236c16394f9a027 (diff) | |
download | postgresql-6162432de9fb023b710c171f196e27b910e45fa7.tar.gz postgresql-6162432de9fb023b710c171f196e27b910e45fa7.zip |
Add more critical-section calls: all code sections that hold spinlocks
are now critical sections, so as to ensure die() won't interrupt us while
we are munging shared-memory data structures. Avoid insecure intermediate
states in some code that proc_exit will call, like palloc/pfree. Rename
START/END_CRIT_CODE to START/END_CRIT_SECTION, since that seems to be
what people tend to call them anyway, and make them be called with () like
a function call, in hopes of not confusing pg_indent.
I doubt that this is sufficient to make SIGTERM safe anywhere; there's
just too much code that could get invoked during proc_exit().
Diffstat (limited to 'src/backend/commands/sequence.c')
-rw-r--r-- | src/backend/commands/sequence.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 64fc0102a87..f6e63283121 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.47 2000/12/28 13:00:17 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.48 2001/01/12 21:53:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -301,7 +301,7 @@ nextval(PG_FUNCTION_ARGS) elm->last = result; /* last returned number */ elm->cached = last; /* last fetched number */ - START_CRIT_CODE; + START_CRIT_SECTION(); if (logit) { xl_seq_rec xlrec; @@ -338,7 +338,7 @@ nextval(PG_FUNCTION_ARGS) seq->is_called = 't'; Assert(log >= 0); seq->log_cnt = log; /* how much is logged */ - END_CRIT_CODE; + END_CRIT_SECTION(); LockBuffer(buf, BUFFER_LOCK_UNLOCK); @@ -398,7 +398,7 @@ do_setval(char *seqname, int32 next, bool iscalled) elm->last = next; /* last returned number */ elm->cached = next; /* last cached number (forget cached values) */ - START_CRIT_CODE; + START_CRIT_SECTION(); { xl_seq_rec xlrec; XLogRecPtr recptr; @@ -429,7 +429,7 @@ do_setval(char *seqname, int32 next, bool iscalled) seq->last_value = next; /* last fetched number */ seq->is_called = iscalled ? 't' : 'f'; seq->log_cnt = (iscalled) ? 0 : 1; - END_CRIT_CODE; + END_CRIT_SECTION(); LockBuffer(buf, BUFFER_LOCK_UNLOCK); |