Commit e450dfe
committed
Adjust the try_lock_until algorithm to match the wording in P3832R2
Since a timed lockable's try_lock_until will not return failure in case
the time given has already expired, but instead return this->try_lock(),
there was a theoretical possibility of never getting out of the loop.
It was essentially possible to get into this situation:
m1.try_lock_until(expired_tp); // succeeds
m2.try_lock(); // fails
m2.try_lock_until(expired_tp); // succeeds
m1.try_lock(); // fails
// back to the original situation and it could keep going
The remedy was to add wording about "the above steps are repeated until
the time point abs_time has been reached" which made it necessary to do
a Clock::now() call before trying a new sequence (sorry Bosse).
Signed-off-by: Ted Lyngmo <ted@lyncon.se>1 parent 26acd25 commit e450dfe
2 files changed
Lines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
| 70 | + | |
| 71 | + | |
72 | 72 | | |
73 | | - | |
74 | | - | |
| 73 | + | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
| 84 | + | |
84 | 85 | | |
85 | | - | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
233 | 233 | | |
0 commit comments