postgresql/src/include/storage
Tom Lane 13db3b9363 Allow ConditionVariable[PrepareTo]Sleep to auto-switch between CVs.
The original coding here insisted that callers manually cancel any prepared
sleep for one condition variable before starting a sleep on another one.
While that's not a huge burden today, it seems like a gotcha that will bite
us in future if the use of condition variables increases; anything we can
do to make the use of this API simpler and more robust is attractive.
Hence, allow these functions to automatically switch their attention to
a different CV when required.  This is safe for the same reason it was OK
for commit aced5a92b to let a broadcast operation cancel any prepared CV
sleep: whenever we return to the other test-and-sleep loop, we will
automatically re-prepare that CV, paying at most an extra test of that
loop's exit condition.

Back-patch to v10 where condition variables were introduced.  Ordinarily
we would probably not back-patch a change like this, but since it does not
invalidate any coding pattern that was legal before, it seems safe enough.
Furthermore, there's an open bug in replorigin_drop() for which the
simplest fix requires this.  Even if we chose to fix that in some more
complicated way, the hazard would remain that we might back-patch some
other bug fix that requires this behavior.

Patch by me, reviewed by Thomas Munro.

Discussion: https://postgr.es/m/2437.1515368316@sss.pgh.pa.us
2018-01-09 11:39:10 -05:00
..
.gitignore When trace_lwlocks is used, identify individual lwlocks by name. 2015-09-11 14:01:39 -04:00
backendid.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
barrier.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
block.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
buf.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
buf_internals.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
buffile.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
bufmgr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
bufpage.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
checksum.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
checksum_impl.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
condition_variable.h Allow ConditionVariable[PrepareTo]Sleep to auto-switch between CVs. 2018-01-09 11:39:10 -05:00
copydir.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
dsm.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
dsm_impl.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
fd.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
freespace.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
fsm_internals.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
indexfsm.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
ipc.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
item.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
itemid.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
itemptr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
large_object.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
latch.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
lmgr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
lock.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
lockdefs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
lwlock.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
off.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_sema.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_shmem.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pmsignal.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
predicate.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
predicate_internals.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
proc.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
procarray.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
proclist.h Improve error detection capability in proclists. 2018-01-08 18:07:04 -05:00
proclist_types.h Improve error detection capability in proclists. 2018-01-08 18:07:04 -05:00
procsignal.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
reinit.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
relfilenode.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
s_lock.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
sharedfileset.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
shm_mq.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
shm_toc.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
shmem.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
sinval.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
sinvaladt.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
smgr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
spin.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
standby.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
standbydefs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00