Skip to content

Commit 751a11f

Browse files
committed
process API change from P1869R1 renaming cv_any interruptible wait methods and arg order
1 parent 8478824 commit 751a11f

File tree

7 files changed

+90
-83
lines changed

7 files changed

+90
-83
lines changed

source/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ test_stoken: stop_token.hpp condition_variable_any2.hpp test_stoken.cpp test.hpp
2424
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_stoken.cpp $(LDFLAGS17) -o $@17raw.exe
2525
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
2626
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
27+
@chmod +x $@.exe
2728
echo "- OK: $@ and $@17 call $@17raw.exe"
2829

2930
run_stoken: test_stoken
@@ -33,6 +34,7 @@ test_stokencb: stop_token.hpp condition_variable_any2.hpp test_stokencb.cpp test
3334
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_stokencb.cpp $(LDFLAGS17) -o $@17raw.exe
3435
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
3536
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
37+
@chmod +x $@.exe
3638
echo "- OK: $@ and $@17 call $@17raw.exe"
3739

3840
run_stokencb: test_stokencb
@@ -42,6 +44,7 @@ test_stokenrace: stop_token.hpp condition_variable_any2.hpp test_stokenrace.cpp
4244
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_stokenrace.cpp $(LDFLAGS17) -o $@17raw.exe
4345
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
4446
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
47+
@chmod +x $@.exe
4548
echo "- OK: $@ and $@17 call $@17raw.exe"
4649

4750
run_stokenrace: test_stokenrace
@@ -51,6 +54,7 @@ test_stopcb: stop_token.hpp test_stopcb.cpp test.hpp Makefile
5154
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_stopcb.cpp $(LDFLAGS17) -o $@17raw.exe
5255
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
5356
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
57+
@chmod +x $@.exe
5458
echo "- OK: $@ and $@17 call $@17raw.exe"
5559

5660
run_stopcb: test_stopcb
@@ -60,6 +64,7 @@ test_jthread1: stop_token.hpp condition_variable_any2.hpp jthread.hpp test_jthre
6064
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_jthread1.cpp $(LDFLAGS17) -o $@17raw.exe
6165
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
6266
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
67+
@chmod +x $@.exe
6368
echo "- OK: $@ and $@17 call $@17raw.exe"
6469

6570
run_jthread1: test_jthread1
@@ -69,6 +74,7 @@ test_jthread2: stop_token.hpp condition_variable_any2.hpp jthread.hpp test_jthre
6974
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_jthread2.cpp $(LDFLAGS17) -o $@17raw.exe
7075
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
7176
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
77+
@chmod +x $@.exe
7278
echo "- OK: $@ and $@17 call $@17raw.exe"
7379

7480
run_jthread2: test_jthread2
@@ -78,6 +84,7 @@ test_cv: stop_token.hpp jthread.hpp condition_variable_any2.hpp test_cv.cpp test
7884
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_cv.cpp $(LDFLAGS17) -o $@17raw.exe
7985
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
8086
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
87+
@chmod +x $@.exe
8188
echo "- OK: $@ and $@17 call $@17raw.exe"
8289

8390
run_cv: test_cv
@@ -87,6 +94,7 @@ test_cvcb: stop_token.hpp jthread.hpp condition_variable_any2.hpp test_cvcb.cpp
8794
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_cvcb.cpp $(LDFLAGS17) -o $@17raw.exe
8895
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
8996
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
97+
@chmod +x $@.exe
9098
echo "- OK: $@ and $@17 call $@17raw.exe"
9199

92100
run_cvcb: test_cvcb
@@ -96,6 +104,7 @@ test_cvrace: stop_token.hpp jthread.hpp condition_variable_any2.hpp test_cvrace.
96104
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_cvrace.cpp $(LDFLAGS17) -o $@17raw.exe
97105
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
98106
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
107+
@chmod +x $@.exe
99108
echo "- OK: $@ and $@17 call $@17raw.exe"
100109

101110
run_cvrace: test_cvrace
@@ -105,6 +114,7 @@ test_cvrace_hh: stop_token.hpp jthread.hpp condition_variable_any2.hpp test_cvra
105114
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_cvrace_hh.cpp $(LDFLAGS17) -o $@17raw.exe
106115
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
107116
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
117+
@chmod +x $@.exe
108118
echo "- OK: $@ and $@17 call $@17raw.exe"
109119

110120
run_cvrace_hh: test_cvrace_hh
@@ -114,6 +124,7 @@ test_cvrace_stop: stop_token.hpp jthread.hpp condition_variable_any2.hpp test_cv
114124
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_cvrace_stop.cpp $(LDFLAGS17) -o $@17raw.exe
115125
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
116126
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
127+
@chmod +x $@.exe
117128
echo "- OK: $@ and $@17 call $@17raw.exe"
118129

119130
run_cvrace_stop: test_cvrace_stop
@@ -123,6 +134,7 @@ test_cvrace_pred: condition_variable_any2.hpp test_cvrace_pred.cpp Makefile
123134
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_cvrace_pred.cpp $(LDFLAGS17) -o $@17raw.exe
124135
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
125136
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
137+
@chmod +x $@.exe
126138
echo "- OK: $@ and $@17 call $@17raw.exe"
127139

128140
run_cvrace_pred: test_cvrace_pred
@@ -132,6 +144,7 @@ test_cvprodcons: stop_token.hpp jthread.hpp condition_variable_any2.hpp test_cvp
132144
$(CXX17) $(CXXFLAGS17) $(INCLUDES) test_cvprodcons.cpp $(LDFLAGS17) -o $@17raw.exe
133145
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@17.exe
134146
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@17raw.exe '$$*' > $@.exe
147+
@chmod +x $@.exe
135148
echo "- OK: $@ and $@17 call $@17raw.exe"
136149

137150
run_cvprodcons: test_cvprodcons
@@ -141,6 +154,7 @@ jthread.clang: jthread.hpp jthread.cpp stop_token.hpp iwait.hpp test.hpp Makefil
141154
$(CXXCLANG) $(CXXFLAGSCLANG) -std=c++1z $(INCLUDES) jthread.cpp $(LDFLAGSCLANG) -o $@clangraw.exe
142155
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@clangraw.exe '$$*' > $@clang.exe
143156
echo PATH=\"$(PATH17)/bin:$$PATH\" ./$@clangraw.exe '$$*' > $@.exe
157+
@chmod +x $@.exe
144158
echo "- OK: $@ and $@17 call $@clangraw.exe"
145159

146160
run_tests: run_cvrace_stop run_cvrace_pred run_cvcb run_cvrace run_cvprodcons run_cv run_jthread2 run_jthread1 run_stokencb run_stoken

source/condition_variable_any2.hpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -155,26 +155,26 @@ class condition_variable_any2
155155
// - true if pred() yields true
156156
// - false otherwise (i.e. on interrupt)
157157
template <class Lockable,class Predicate>
158-
bool wait_until(Lockable& lock,
159-
Predicate pred,
160-
stop_token stoken);
158+
bool wait(Lockable& lock,
159+
stop_token stoken,
160+
Predicate pred);
161161

162162
// return:
163163
// - true if pred() yields true
164164
// - false otherwise (i.e. on timeout or interrupt)
165165
template <class Lockable, class Clock, class Duration, class Predicate>
166166
bool wait_until(Lockable& lock,
167+
stop_token stoken,
167168
const chrono::time_point<Clock, Duration>& abs_time,
168-
Predicate pred,
169-
stop_token stoken);
169+
Predicate pred);
170170
// return:
171171
// - true if pred() yields true
172172
// - false otherwise (i.e. on timeout or interrupt)
173173
template <class Lockable, class Rep, class Period, class Predicate>
174174
bool wait_for(Lockable& lock,
175+
stop_token stoken,
175176
const chrono::duration<Rep, Period>& rel_time,
176-
Predicate pred,
177-
stop_token stoken);
177+
Predicate pred);
178178

179179
//*****************************************
180180
//* implementation:
@@ -214,9 +214,9 @@ class condition_variable_any2
214214
// - true if pred() yields true
215215
// - false otherwise (i.e. on interrupt)
216216
template <class Lockable, class Predicate>
217-
inline bool condition_variable_any2::wait_until(Lockable& lock,
218-
Predicate pred,
219-
stop_token stoken)
217+
inline bool condition_variable_any2::wait(Lockable& lock,
218+
stop_token stoken,
219+
Predicate pred)
220220
{
221221
if (stoken.stop_requested()) {
222222
return pred();
@@ -244,9 +244,9 @@ inline bool condition_variable_any2::wait_until(Lockable& lock,
244244
// - false otherwise (i.e. on timeout or interrupt)
245245
template <class Lockable, class Clock, class Duration, class Predicate>
246246
inline bool condition_variable_any2::wait_until(Lockable& lock,
247-
const chrono::time_point<Clock, Duration>& abs_time,
248-
Predicate pred,
249-
stop_token stoken)
247+
stop_token stoken,
248+
const chrono::time_point<Clock, Duration>& abs_time,
249+
Predicate pred)
250250
{
251251
if (stoken.stop_requested()) {
252252
return pred();
@@ -282,15 +282,15 @@ inline bool condition_variable_any2::wait_until(Lockable& lock,
282282
// - false otherwise (i.e. on timeout or interrupt)
283283
template <class Lockable,class Rep, class Period, class Predicate>
284284
inline bool condition_variable_any2::wait_for(Lockable& lock,
285-
const chrono::duration<Rep, Period>& rel_time,
286-
Predicate pred,
287-
stop_token stoken)
285+
stop_token stoken,
286+
const chrono::duration<Rep, Period>& rel_time,
287+
Predicate pred)
288288
{
289289
auto abs_time = std::chrono::steady_clock::now() + rel_time;
290290
return wait_until(lock,
291+
std::move(stoken),
291292
abs_time,
292-
std::move(pred),
293-
std::move(stoken));
293+
std::move(pred));
294294
}
295295

296296

0 commit comments

Comments
 (0)