Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/exec/static_thread_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,12 @@ namespace experimental::execution
void start() & noexcept
{
std::size_t size = items_.size();
if (size == 0)
{
STDEXEC::set_value(static_cast<Receiver&&>(this->rcvr_));
return;
}

std::size_t nthreads = this->pool_.available_parallelism();
bwos_params params = this->pool_.params();
std::size_t local_size = params.blockSize * params.numBlocks;
Expand Down
12 changes: 12 additions & 0 deletions test/exec/test_static_thread_pool.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include "catch2/catch_all.hpp"
#include <exec/sequence/ignore_all_values.hpp>
#include <exec/static_thread_pool.hpp>
#include <stdexec/execution.hpp>

#include <mutex>
#include <ranges>
#include <thread>
#include <unordered_set>
namespace ex = STDEXEC;
Expand Down Expand Up @@ -45,6 +47,16 @@ TEST_CASE("bulk on static_thread_pool executes on multiple threads", "[types][st
REQUIRE(thread_ids.size() == num_of_threads);
}

TEST_CASE("schedule_all on static_thread_pool handles empty ranges",
"[types][static_thread_pool]")
{
exec::static_thread_pool pool{2};
auto sender = exec::schedule_all(pool, std::views::iota(size_t{0}, size_t{0}))
| exec::ignore_all_values();

CHECK(ex::sync_wait(std::move(sender)));
}

TEST_CASE("bulk on static_thread_pool executes on multiple threads, take 2",
"[types][static_thread_pool]")
{
Expand Down