aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2015-10-16 14:06:22 -0400
committerRobert Haas <rhaas@postgresql.org>2015-10-16 14:06:22 -0400
commit78652a3332128c89ae369e03698f7212ca73d022 (patch)
tree68c42fadedbddb92873a23c1167b641d811e073b
parenta53c06a13eb4669d08ce8a5199aee51f88dd453e (diff)
downloadpostgresql-78652a3332128c89ae369e03698f7212ca73d022.tar.gz
postgresql-78652a3332128c89ae369e03698f7212ca73d022.zip
Remove cautions about using volatile from spin.h.
Commit 0709b7ee72e4bc71ad07b7120acd117265ab51d0 obsoleted this comment but neglected to update it. Thomas Munro
-rw-r--r--src/include/storage/spin.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/include/storage/spin.h b/src/include/storage/spin.h
index dc6856e4aca..4674f48164e 100644
--- a/src/include/storage/spin.h
+++ b/src/include/storage/spin.h
@@ -25,15 +25,10 @@
* Callers must beware that the macro argument may be evaluated multiple
* times!
*
- * CAUTION: Care must be taken to ensure that loads and stores of
- * shared memory values are not rearranged around spinlock acquire
- * and release. This is done using the "volatile" qualifier: the C
- * standard states that loads and stores of volatile objects cannot
- * be rearranged *with respect to other volatile objects*. The
- * spinlock is always written through a volatile pointer by the
- * spinlock macros, but this is not sufficient by itself: code that
- * protects shared data with a spinlock MUST reference that shared
- * data through a volatile pointer.
+ * Load and store operations in calling code are guaranteed not to be
+ * reordered with respect to these operations, because they include a
+ * compiler barrier. (Before PostgreSQL 9.5, callers needed to use a
+ * volatile qualifier to access data protected by spinlocks.)
*
* Keep in mind the coding rule that spinlocks must not be held for more
* than a few instructions. In particular, we assume it is not possible