File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change 3
3
4
4
<issue num =" 4172" status =" New" >
5
5
<title >unique_lock self-move-assignment is broken</title >
6
- <section ><sref ref =" [thread.lock.unique.cons]" /></section >
6
+ <section ><sref ref =" [thread.lock.unique.cons]" /> < sref ref = " [thread.lock.shared.cons] " /> </section >
7
7
<submitter >Casey Carter</submitter >
8
8
<date >13 Nov 2024</date >
9
9
<priority >99</priority >
@@ -28,6 +28,11 @@ from self-move-assignment as of LWG <iref ref="2839"/>.
28
28
<p >
29
29
Also, the move assignment operator doesn't specify what it returns.
30
30
</p >
31
+
32
+ <note >2024-11-18; Casey expands the PR to cover `shared_lock`</note >
33
+ <p >
34
+ `shared_lock` has the same problems, and can be fixed in the same way.
35
+ </p >
31
36
</discussion >
32
37
33
38
<resolution >
@@ -99,6 +104,33 @@ In this case, *this will own the mutex after the assignment and u will not.
99
104
</p >
100
105
</blockquote >
101
106
</li >
107
+
108
+ <li >
109
+ <p >
110
+ Modify <sref ref =" [thread.lock.shared.cons]" /> as follows:
111
+ </p >
112
+
113
+ <blockquote >
114
+ <pre ><code >
115
+ shared_lock& operator=(shared_lock&& sl) noexcept;
116
+ </code ></pre >
117
+ <p >
118
+ -17- <i >Effects</i >:
119
+ <del >If `owns` calls `pm->unlock_shared()`.</del >
120
+ <ins >Equivalent to: `shared_lock{std::move(sl)}.swap(*this)`.</ins >
121
+ </p >
122
+ <p >
123
+ <ins >-?- <i >Returns</i >: `*this`.</ins >
124
+ </p >
125
+ <p >
126
+ <del >-18- <i >Postconditions</i >:
127
+ `pm == sl_p.pm` and `owns == sl_p.owns`
128
+ (where `sl_p` is the state of `sl` just prior to this assignment),
129
+ `sl.pm == nullptr` and `sl.owns == false`.
130
+ </del >
131
+ </p >
132
+ </blockquote >
133
+ </li >
102
134
</ol >
103
135
104
136
</resolution >
You can’t perform that action at this time.
0 commit comments