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 33
44<issue num =" 4172" status =" New" >
55<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 >
77<submitter >Casey Carter</submitter >
88<date >13 Nov 2024</date >
99<priority >99</priority >
@@ -28,6 +28,11 @@ from self-move-assignment as of LWG <iref ref="2839"/>.
2828<p >
2929Also, the move assignment operator doesn't specify what it returns.
3030</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 >
3136</discussion >
3237
3338<resolution >
@@ -99,6 +104,33 @@ In this case, *this will own the mutex after the assignment and u will not.
99104</p >
100105</blockquote >
101106</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 >
102134</ol >
103135
104136</resolution >
You can’t perform that action at this time.
0 commit comments