@@ -892,7 +892,6 @@ namespace {
892892 }
893893 }
894894
895- // TODO: also add similar tests for bulk_chunked and bulk_unchunked
896895 TEST_CASE (" eager customization of bulk works with static thread pool" , " [adaptors][bulk]" ) {
897896 exec::static_thread_pool pool{4 };
898897 ex::scheduler auto sch = pool.get_scheduler ();
@@ -907,7 +906,6 @@ namespace {
907906
908907 auto snd = ex::just () //
909908 | ex::continues_on (sch) | ex::bulk (ex::par, tids.size (), fun);
910- CHECK (std::equal_to<void *>()(&snd.pool_ , &pool));
911909 stdexec::sync_wait (std::move (snd));
912910
913911 // All the work should not have run on the same thread
@@ -918,7 +916,34 @@ namespace {
918916 }
919917 }
920918
921- // TODO: also add similar tests for bulk_chunked and bulk_unchunked
919+ TEST_CASE (
920+ " eager customization of bulk_chunked works with static thread pool" ,
921+ " [adaptors][bulk]" ) {
922+ exec::static_thread_pool pool{4 };
923+ ex::scheduler auto sch = pool.get_scheduler ();
924+
925+ SECTION (" Without values in the set_value channel" ) {
926+ std::vector<std::thread::id> tids (42 );
927+
928+ auto fun = [&tids](std::size_t b, std::size_t e) {
929+ while (b < e) {
930+ tids[b++] = std::this_thread::get_id ();
931+ }
932+ std::this_thread::sleep_for (std::chrono::milliseconds{10 });
933+ };
934+
935+ auto snd = ex::just () //
936+ | ex::continues_on (sch) | ex::bulk_chunked (ex::par, tids.size (), fun);
937+ stdexec::sync_wait (std::move (snd));
938+
939+ // All the work should not have run on the same thread
940+ const auto actual = static_cast <std::size_t >(std::count (tids.begin (), tids.end (), tids[0 ]));
941+ const std::size_t wrong = tids.size ();
942+
943+ CHECK (actual != wrong);
944+ }
945+ }
946+
922947 TEST_CASE (" lazy customization of bulk works with static thread pool" , " [adaptors][bulk]" ) {
923948 exec::static_thread_pool pool{4 };
924949 ex::scheduler auto sch = pool.get_scheduler ();
@@ -943,6 +968,32 @@ namespace {
943968 }
944969 }
945970
971+ TEST_CASE (" lazy customization of bulk_chunked works with static thread pool" , " [adaptors][bulk]" ) {
972+ exec::static_thread_pool pool{4 };
973+ ex::scheduler auto sch = pool.get_scheduler ();
974+
975+ SECTION (" Without values in the set_value channel" ) {
976+ std::vector<std::thread::id> tids (42 );
977+
978+ auto fun = [&tids](std::size_t b, std::size_t e) {
979+ while (b < e) {
980+ tids[b++] = std::this_thread::get_id ();
981+ }
982+ std::this_thread::sleep_for (std::chrono::milliseconds{10 });
983+ };
984+
985+ auto snd = ex::just () //
986+ | ex::bulk_chunked (ex::par, tids.size (), fun);
987+ stdexec::sync_wait (stdexec::starts_on (sch, std::move (snd)));
988+
989+ // All the work should not have run on the same thread
990+ const auto actual = static_cast <std::size_t >(std::count (tids.begin (), tids.end (), tids[0 ]));
991+ const std::size_t wrong = tids.size ();
992+
993+ CHECK (actual != wrong);
994+ }
995+ }
996+
946997 TEST_CASE (" default bulk works with non-default constructible types" , " [adaptors][bulk]" ) {
947998 ex::sender auto s = ex::just (non_default_constructible{42 })
948999 | ex::bulk (ex::par, 1 , [](int , auto &) { });
@@ -986,8 +1037,7 @@ namespace {
9861037 auto snd = ex::just (std::string{" hello" })
9871038 | exec::on (
9881039 sched, //
989- ex::bulk (ex::par, 1 , [&called](int , std::string x) { called = true ; }))
990- | exec::write (stdexec::prop{ex::get_scheduler, inline_scheduler ()});
1040+ ex::bulk (ex::par, 1 , [&called](int , std::string x) { called = true ; }));
9911041 wait_for_value (std::move (snd), std::string{" hijacked" });
9921042 REQUIRE_FALSE (called);
9931043 }
0 commit comments