| 1744 | } |
| 1745 | |
| 1746 | void start() & noexcept |
| 1747 | { |
| 1748 | std::size_t size = items_.size(); |
| 1749 | std::size_t nthreads = this->pool_.available_parallelism(); |
| 1750 | bwos_params params = this->pool_.params(); |
| 1751 | std::size_t local_size = params.blockSize * params.numBlocks; |
| 1752 | std::size_t chunk_size = __umin({size / nthreads, local_size * nthreads}); |
| 1753 | auto& remote_queue = *this->pool_.get_remote_queue(); |
| 1754 | auto it = std::ranges::begin(this->range_); |
| 1755 | std::size_t i0 = 0; |
| 1756 | while (i0 + chunk_size < size) |
| 1757 | { |
| 1758 | for (std::size_t i = i0; i < i0 + chunk_size; ++i) |
| 1759 | { |
| 1760 | items_[i].__construct_from(STDEXEC::connect, |
| 1761 | set_next(this->rcvr_, item_sender_t{this, it + i}), |
| 1762 | next_receiver_t{this}); |
| 1763 | STDEXEC::start(items_[i].__get()); |
| 1764 | } |
| 1765 | |
| 1766 | std::unique_lock lock{this->start_mutex_}; |
| 1767 | this->pool_.bulk_enqueue(remote_queue, std::move(this->tasks_), this->tasks_size_); |
| 1768 | lock.unlock(); |
| 1769 | i0 += chunk_size; |
| 1770 | } |
| 1771 | for (std::size_t i = i0; i < size; ++i) |
| 1772 | { |
| 1773 | items_[i].__construct_from(STDEXEC::connect, |
| 1774 | set_next(this->rcvr_, item_sender_t{this, it + i}), |
| 1775 | next_receiver_t{this}); |
| 1776 | STDEXEC::start(items_[i].__get()); |
| 1777 | } |
| 1778 | std::unique_lock lock{this->start_mutex_}; |
| 1779 | this->has_started_ = true; |
| 1780 | this->pool_.bulk_enqueue(remote_queue, std::move(this->tasks_), this->tasks_size_); |
| 1781 | } |
| 1782 | }; |
| 1783 | |
| 1784 | template <class Range> |
nothing calls this directly
no test coverage detected