@@ -98,12 +98,14 @@ size_t random_ms(size_t max = 3) {
9898 */
9999void wait_all(
100100 ThreadPool& pool, bool use_wait, std::vector<ThreadPool::Task>& results) {
101+ // Do not use REQUIRE_NOTHROW here; it will invoke more test code and Catch2's
102+ // checks are not reentrant.
101103 if (use_wait) {
102104 for (auto& r : results) {
103- REQUIRE_NOTHROW( pool.wait(r) );
105+ pool.wait(r);
104106 }
105107 } else {
106- REQUIRE_NOTHROW( pool.wait_all(results) );
108+ pool.wait_all(results);
107109 }
108110}
109111
@@ -185,7 +187,7 @@ TEST_CASE(
185187
186188 // Because the thread pool has 2 threads, the first two will probably be
187189 // executing at this point, but some will still be queued.
188- REQUIRE_THROWS (cancelable_tasks.cancel_all_tasks());
190+ REQUIRE_NOTHROW (cancelable_tasks.cancel_all_tasks());
189191 }
190192
191193 SECTION("- With cancellation callback") {
@@ -206,7 +208,7 @@ TEST_CASE(
206208
207209 // Because the thread pool has 2 threads, the first two will probably be
208210 // executing at this point, but some will still be queued.
209- REQUIRE_THROWS (cancelable_tasks.cancel_all_tasks());
211+ REQUIRE_NOTHROW (cancelable_tasks.cancel_all_tasks());
210212 REQUIRE(num_cancelled == ((int64_t)tasks.size() - result));
211213 }
212214}
0 commit comments