aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@yahooinc.com>2023-02-03 15:19:40 +0000
committerHåvard Pettersen <havardpe@yahooinc.com>2023-02-03 15:19:40 +0000
commit7761b23b156cb8ed36c84a9942bcb4ac0e1cc636 (patch)
tree09602791ca5fd1474ca1e593779a87bbd4df10b7
parentdd3f8501c791ff12032046907688c8f3e960cdd3 (diff)
avoid using co_await inside other constructs (if/for)
-rw-r--r--vespalib/src/tests/coro/async_io/async_io_test.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/vespalib/src/tests/coro/async_io/async_io_test.cpp b/vespalib/src/tests/coro/async_io/async_io_test.cpp
index 2e783c46e6f..f20dde8b22c 100644
--- a/vespalib/src/tests/coro/async_io/async_io_test.cpp
+++ b/vespalib/src/tests/coro/async_io/async_io_test.cpp
@@ -30,8 +30,10 @@ vespalib::string impl_spec(AsyncIo &async) {
}
Detached self_exiting_run_loop(AsyncIo::SP async) {
- for (size_t i = 0; co_await async->schedule(); ++i) {
+ bool ok = co_await async->schedule();
+ for (size_t i = 0; ok; ++i) {
fprintf(stderr, "self_exiting_run_loop -> current value: %zu\n", i);
+ ok = co_await async->schedule();
}
fprintf(stderr, "self_exiting_run_loop -> exiting\n");
}