13 #ifndef __UT_TaskExclusive__
14 #define __UT_TaskExclusive__
16 #ifndef __TBB_show_deprecation_message_task_H
17 #define __TBB_show_deprecation_message_task_H
18 #define UT_TASK_EXCLUSIVE_RESTORE_DEPRECATION_MESSAGE
110 bool run_in_task_arena =
true,
111 bool use_spinlock =
false)
136 arena->
execute([
this,&func,arena_group,parent_task_scope]()
139 group->
run([
this,&func,parent_task_scope]()
145 myState.markAsDone(
nullptr,
true);
154 myState.setAndRetainArenaGroup(arena_group);
161 myState.decrefArenaGroup();
172 auto *arena_group = myState.getArenaGroup();
180 arena_group = myState.getArenaGroup();
181 }
while (!arena_group);
203 myState.decrefArenaGroup();
205 else if (use_spinlock)
212 myState.markAsDone(
nullptr,
false);
230 ComputeTask *root = ComputeTask::createRoot(myState, func);
231 ComputeTask::spawnRootAndWait(*root);
236 DummyTask *root = DummyTask::createRoot(myState);
237 DummyTask::spawnRootAndWait(*root);
250 myState.markAsDoneNoThread();
262 bool hasRun()
const {
return myState.isDone(); }
265 class ComputeTask :
public UT_Task
275 return new (allocate_root()) ComputeTask(state, func);
281 myState.markAsDone(
this,
false);
287 class DummyTask :
public UT_Task
296 return new (allocate_root()) DummyTask(state);
319 myState.addWaitingTask(*
this);
330 #ifdef UT_TASK_EXCLUSIVE_RESTORE_DEPRECATION_MESSAGE
331 #undef __TBB_show_deprecation_message_task_H
332 #undef UT_TASK_EXCLUSIVE_RESTORE_DEPRECATION_MESSAGE
Thread has acquired responsibility to evaluate node.
#define SYS_PRAGMA_PUSH_WARN()
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
static const UT_TaskScope * getCurrent()
#define SYS_DEPRECATED_PUSH_DISABLE()
A task node for managing which thread is currently working on a given task.
#define SYS_DEPRECATED_POP_DISABLE()
The node has been evaluated with an arena.
tbb::task_group_status wait()
void recycleAsSafeContinuation()
#define SYS_PRAGMA_POP_WARN()
#define SYS_PRAGMA_DISABLE_ATTRIBUTES()
virtual UT_Task * run()=0
void executeNoThread(T &func)
Another thread is busy evaluating the node without an arena.
Another thread is busy evaluating the node with an arena.
std::pair< UT_TaskArena, UT_TaskGroup > ArenaAndGroup
void execute(T &func, bool run_in_task_arena=true, bool use_spinlock=false)