Skip to content

thread pools based on execpools::thread_pool_base are not customizing the bulk* algorithms correctly #1687

@ericniebler

Description

@ericniebler

this problem effects the asio_thread_pool, the taskflow_threadpool, and the tbb_thread_pool. thread_pool_base attempts to customize bulk (and only bulk) as follows:

      template <stdexec::sender S, std::integral Shape, class Fun>
      STDEXEC_MEMFN_DECL(
        auto bulk)(this const scheduler& sch, S&& sndr, Shape shape, Fun fun) noexcept
        -> bulk_sender_t<S, Shape, Fun> {
        // ...
      }

the first thing wrong is that this function does not accept an execution policy. the second wrong thing is that the STDEXEC_MEMFN_DECL macro expands to a hidden overload of tag_invoke:

      template <stdexec::sender S, std::integral Shape, class Fun>
      friend auto tag_invoke(bulk_t, const scheduler& sch, S&& sndr, Shape shape, Fun fun) noexcept
        -> bulk_sender_t<S, Shape, Fun> {
        // ...
      }

tag_invoke is no longer used to find algorithm customizations, so this overload will never be considered.

thread_pool_base should do like static_thread_pool does by defining a domain with a transform_sender member constrained to accept bulk_chunked_t and bulk_unchunked_t senders that transforms those senders into ones that use thread_pool_base::bulk_enqueue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions