- Notifications
You must be signed in to change notification settings - Fork28
Commit13db3b9
committed
Allow ConditionVariable[PrepareTo]Sleep to auto-switch between CVs.
The original coding here insisted that callers manually cancel any preparedsleep 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 biteus in future if the use of condition variables increases; anything we cando to make the use of this API simpler and more robust is attractive.Hence, allow these functions to automatically switch their attention toa different CV when required. This is safe for the same reason it was OKfor commitaced5a9 to let a broadcast operation cancel any prepared CVsleep: whenever we return to the other test-and-sleep loop, we willautomatically re-prepare that CV, paying at most an extra test of thatloop's exit condition.Back-patch to v10 where condition variables were introduced. Ordinarilywe would probably not back-patch a change like this, but since it does notinvalidate any coding pattern that was legal before, it seems safe enough.Furthermore, there's an open bug in replorigin_drop() for which thesimplest fix requires this. Even if we chose to fix that in some morecomplicated way, the hazard would remain that we might back-patch someother bug fix that requires this behavior.Patch by me, reviewed by Thomas Munro.Discussion:https://postgr.es/m/2437.1515368316@sss.pgh.pa.us1 parent921059b commit13db3b9
File tree
2 files changed
+15
-15
lines changed- src
- backend/storage/lmgr
- include/storage
2 files changed
+15
-15
lines changedLines changed: 14 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
55 | 55 |
| |
56 | 56 |
| |
57 | 57 |
| |
58 |
| - | |
59 |
| - | |
60 |
| - | |
61 |
| - | |
62 | 58 |
| |
63 | 59 |
| |
64 | 60 |
| |
| |||
81 | 77 |
| |
82 | 78 |
| |
83 | 79 |
| |
84 |
| - | |
85 |
| - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
86 | 86 |
| |
87 |
| - | |
| 87 | + | |
| 88 | + | |
88 | 89 |
| |
89 | 90 |
| |
90 | 91 |
| |
| |||
133 | 134 |
| |
134 | 135 |
| |
135 | 136 |
| |
| 137 | + | |
| 138 | + | |
| 139 | + | |
136 | 140 |
| |
137 |
| - | |
| 141 | + | |
138 | 142 |
| |
139 | 143 |
| |
140 | 144 |
| |
141 | 145 |
| |
142 | 146 |
| |
143 |
| - | |
144 |
| - | |
145 |
| - | |
146 | 147 |
| |
147 | 148 |
| |
148 | 149 |
| |
| |||
265 | 266 |
| |
266 | 267 |
| |
267 | 268 |
| |
268 |
| - | |
| 269 | + | |
| 270 | + | |
269 | 271 |
| |
270 | 272 |
| |
271 | 273 |
| |
|
Lines changed: 1 addition & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
43 |
| - | |
44 |
| - | |
45 |
| - | |
| 43 | + | |
46 | 44 |
| |
47 | 45 |
| |
48 | 46 |
| |
|
0 commit comments
Comments
(0)