File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -407,7 +407,7 @@ namespace exec {
407407
408408 static_thread_pool_* pool_;
409409 remote_queue* queue_;
410- const nodemask* nodemask_;
410+ const nodemask* nodemask_ = & nodemask::any () ;
411411 std::size_t thread_idx_{std::numeric_limits<std::size_t >::max ()};
412412
413413 public:
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ set(exec_test_sources
4444 test_trampoline_scheduler.cpp
4545 test_sequence_senders.cpp
4646 test_sequence.cpp
47+ test_static_thread_pool.cpp
4748 test_just_from.cpp
4849 sequence/test_any_sequence_of.cpp
4950 sequence/test_empty_sequence.cpp
Original file line number Diff line number Diff line change 1+ #include " catch2/catch.hpp"
2+ #include < exec/static_thread_pool.hpp>
3+ #include < stdexec/execution.hpp>
4+
5+ #include < thread>
6+ #include < unordered_set>
7+ namespace ex = stdexec;
8+
9+ TEST_CASE (
10+ " static_thread_pool::get_scheduler_on_thread Test start on a specific thread" ,
11+ " [types][static_thread_pool]" ) {
12+ constexpr const size_t num_of_threads = 5 ;
13+ exec::static_thread_pool pool{num_of_threads};
14+
15+ std::unordered_set<std::thread::id> thread_ids;
16+ for (size_t i = 0 ; i < num_of_threads; ++i) {
17+ auto sender = ex::schedule (pool.get_scheduler_on_thread (i))
18+ | ex::then ([&] { thread_ids.insert (std::this_thread::get_id ()); });
19+ ex::sync_wait (std::move (sender));
20+ }
21+ REQUIRE (thread_ids.size () == num_of_threads);
22+ }
You can’t perform that action at this time.
0 commit comments