17enum class ParentCascadeCancel { kOff, kOn };
20#include <dispenso/detail/task_set_impl.h>
24constexpr ssize_t kDefaultStealingMultiplier = 4;
51 token_(makeToken(
p.work_)) {}
54 TaskSet(ThreadPool& p, ssize_t stealingLoadMultiplier)
55 : TaskSet(p, ParentCascadeCancel::kOff, stealingLoadMultiplier) {}
57 TaskSet(TaskSet&& other) =
delete;
58 TaskSet& operator=(TaskSet&& other) =
delete;
75 if (DISPENSO_EXPECT(
canceled(),
false)) {
107 DISPENSO_DLL_ACCESS
bool wait();
131 TaskSetBase::cancel();
140 return TaskSetBase::canceled();
152 DISPENSO_DLL_ACCESS moodycamel::ProducerToken makeToken(
153 moodycamel::ConcurrentQueue<OnceFunction>&
pool);
155 moodycamel::ProducerToken token_;
157 template <
typename Result>
158 friend class detail::FutureBase;
190 ConcurrentTaskSet(ThreadPool& p, ssize_t stealingLoadMultiplier)
191 : ConcurrentTaskSet(p, ParentCascadeCancel::kOff, stealingLoadMultiplier) {}
212 template <
typename F>
215 DISPENSO_EXPECT(!
canceled(),
true)) {
235 template <
typename F>
244 DISPENSO_DLL_ACCESS
bool wait();
268 TaskSetBase::cancel();
277 return TaskSetBase::canceled();
289 bool tryExecuteNext() {
290 return pool_.tryExecuteNext();
293 template <
typename Result>
294 friend class detail::FutureBase;
296 friend class detail::LimitGatedScheduler;
304DISPENSO_DLL_ACCESS TaskSetBase* parentTaskSet();
void schedule(F &&f, bool skipRecheck=false)
void schedule(F &&f, ForceQueuingTag fq)
DISPENSO_DLL_ACCESS bool tryWait(size_t maxToExecute)
ConcurrentTaskSet(ThreadPool &pool, ParentCascadeCancel registerForParentCancel, ssize_t stealingLoadMultiplier=kDefaultStealingMultiplier)
DISPENSO_DLL_ACCESS bool wait()
DISPENSO_DLL_ACCESS bool tryWait(size_t maxToExecute)
void schedule(F &&f, ForceQueuingTag fq)
TaskSet(ThreadPool &p, ParentCascadeCancel registerForParentCancel, ssize_t stealingLoadMultiplier=kDefaultStealingMultiplier)
DISPENSO_DLL_ACCESS bool wait()
detail::OpResult< T > OpResult