forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3cac0ec
committed
Reorder steps in ConditionVariablePrepareToSleep for more safety.
In the admittedly-very-unlikely case that AddWaitEventToSet fails,ConditionVariablePrepareToSleep would error out after already havingset cv_sleep_target, which is probably bad, and after having alreadyset cv_wait_event_set, which is very bad. Transaction abort might ormight not clean up cv_sleep_target properly; but there is nothingthat would be aware that the WaitEventSet wasn't fully constructed,so that all future condition variable sleeps would be broken.We can easily guard against these hazards with slight restructuring.Back-patch to v10 where condition_variable.c was introduced.Discussion:https://postgr.es/m/CAEepm=0NWKehYw7NDoUSf8juuKOPRnCyY3vuaSvhrEWsOTAa3w@mail.gmail.com1 parentaced5a9 commit3cac0ec
1 file changed
+15
-8
lines changedLines changed: 15 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
54 | 54 |
| |
55 | 55 |
| |
56 | 56 |
| |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
57 | 72 |
| |
58 | 73 |
| |
59 | 74 |
| |
| |||
63 | 78 |
| |
64 | 79 |
| |
65 | 80 |
| |
66 |
| - | |
67 |
| - | |
68 |
| - | |
69 |
| - | |
70 |
| - | |
71 |
| - | |
72 |
| - | |
73 |
| - | |
74 | 81 |
| |
75 | 82 |
| |
76 | 83 |
| |
|
0 commit comments
Comments
(0)