@@ -70,19 +70,25 @@ int hpx_main()
7070 }
7171
7272 // -----------------------------------------------------------------------
73- // Test 2: split with thread_pool_scheduler via pipeline syntax .
73+ // Test 2: split with a custom scheduler using a scheduler-aware sender .
7474 //
75- // The pipeline `sched | ex::split(just(100))` triggers
76- // tag_override_invoke which reads get_completion_scheduler<set_value_t>
77- // from the sender, and routes to our new generic-scheduler tag_invoke on
78- // split_t. Late-arriving subscribers must get their completion on the
79- // thread pool, not inline on this thread.
75+ // This test uses `ex::split(ex::transfer(ex::just(100), sched))`.
76+ // `ex::transfer` attaches `sched` as the completion scheduler of the
77+ // predecessor sender, and `ex::split` must preserve that scheduler when a
78+ // late subscriber connects after the predecessor has already completed.
79+ // Late-arriving subscribers must get their completion on the custom scheduler,
80+ // not inline on this thread.
8081 // -----------------------------------------------------------------------
8182 {
82- ex::thread_pool_scheduler sched{};
83-
84- // just(100) | transfer(sched) gives a sender whose completion
85- // scheduler is sched, so split picks up the scheduler automatically.
83+ std::atomic<bool > schedule_called{false };
84+ std::atomic<bool > execute_called{false };
85+ std::atomic<bool > tag_invoke_overload_called{false };
86+ example_scheduler sched{
87+ schedule_called, execute_called, tag_invoke_overload_called};
88+
89+ // `ex::transfer(ex::just(100), sched)` gives a sender whose completion
90+ // scheduler is `sched`, so `ex::split` picks up the scheduler
91+ // automatically.
8692 auto shared_s = ex::split (ex::transfer (ex::just (100 ), sched));
8793
8894 std::atomic<int > call_count{0 };
@@ -94,14 +100,17 @@ int hpx_main()
94100 }));
95101 HPX_TEST_EQ (call_count.load (), 1 );
96102
103+ schedule_called = false ;
104+
97105 // Second subscriber — predecessor_done is now true.
98106 // Before the fix: fires inline on THIS thread.
99- // After the fix: dispatched through thread_pool_scheduler .
107+ // After the fix: dispatched through the custom scheduler .
100108 tt::sync_wait (ex::then (shared_s, [&](int v) {
101109 HPX_TEST_EQ (v, 100 );
102110 ++call_count;
103111 }));
104112 HPX_TEST_EQ (call_count.load (), 2 );
113+ HPX_TEST (schedule_called.load ());
105114 }
106115
107116 // -----------------------------------------------------------------------
0 commit comments