Skip to content

Commit 78652a3

Browse files
committed
Remove cautions about using volatile from spin.h.
Commit 0709b7e obsoleted this comment but neglected to update it. Thomas Munro
1 parent a53c06a commit 78652a3

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/include/storage/spin.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,10 @@
2525
* Callers must beware that the macro argument may be evaluated multiple
2626
* times!
2727
*
28-
* CAUTION: Care must be taken to ensure that loads and stores of
29-
* shared memory values are not rearranged around spinlock acquire
30-
* and release. This is done using the "volatile" qualifier: the C
31-
* standard states that loads and stores of volatile objects cannot
32-
* be rearranged *with respect to other volatile objects*. The
33-
* spinlock is always written through a volatile pointer by the
34-
* spinlock macros, but this is not sufficient by itself: code that
35-
* protects shared data with a spinlock MUST reference that shared
36-
* data through a volatile pointer.
28+
* Load and store operations in calling code are guaranteed not to be
29+
* reordered with respect to these operations, because they include a
30+
* compiler barrier. (Before PostgreSQL 9.5, callers needed to use a
31+
* volatile qualifier to access data protected by spinlocks.)
3732
*
3833
* Keep in mind the coding rule that spinlocks must not be held for more
3934
* than a few instructions. In particular, we assume it is not possible

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy