mirror of
https://github.com/postgres/postgres.git
synced 2025-08-31 17:02:12 +03:00
Add barriers to the latch code.
Since their introduction latches have required barriers in SetLatch and ResetLatch - but when they were introduced there wasn't any barrier abstraction. Instead latches were documented to rely on the callsites to provide barrier semantics. Now that the barrier support looks halfway complete, add the necessary barriers to both latch implementations. Also remove a now superflous lock acquisition from syncrep.c and a superflous (and insufficient) barrier from freelist.c. There might be other cases that can now be simplified, but those are the only ones I've seen on a quick scan. We might want to backpatch this at some later point, but right now the barrier infrastructure in the backbranches isn't totally on par with master. Discussion: 20150112154026.GB2092@awork2.anarazel.de
This commit is contained in:
@@ -57,13 +57,6 @@
|
||||
* SetLatch *after* that. SetLatch is designed to return quickly if the
|
||||
* latch is already set.
|
||||
*
|
||||
* Presently, when using a shared latch for interprocess signalling, the
|
||||
* flag variable(s) set by senders and inspected by the wait loop must
|
||||
* be protected by spinlocks or LWLocks, else it is possible to miss events
|
||||
* on machines with weak memory ordering (such as PPC). This restriction
|
||||
* will be lifted in future by inserting suitable memory barriers into
|
||||
* SetLatch and ResetLatch.
|
||||
*
|
||||
* On some platforms, signals will not interrupt the latch wait primitive
|
||||
* by themselves. Therefore, it is critical that any signal handler that
|
||||
* is meant to terminate a WaitLatch wait calls SetLatch.
|
||||
|
Reference in New Issue
Block a user