24 #ifndef PXR_BASE_WORK_DETACHED_TASK_H 25 #define PXR_BASE_WORK_DETACHED_TASK_H 31 #include "pxr/base/work/api.h" 34 #include <type_traits> 37 PXR_NAMESPACE_OPEN_SCOPE
40 struct Work_DetachedTask
42 explicit Work_DetachedTask(Fn &&fn) : _fn(std::move(fn)) {}
43 explicit Work_DetachedTask(Fn
const &fn) : _fn(fn) {}
57 void Work_EnsureDetachedTaskProgress();
64 using FnType =
typename std::remove_reference<Fn>::type;
65 Work_DetachedTask<FnType> task(std::forward<Fn>(fn));
67 Work_GetDetachedDispatcher().
Run(std::move(task));
68 Work_EnsureDetachedTaskProgress();
75 PXR_NAMESPACE_CLOSE_SCOPE
77 #endif // PXR_BASE_WORK_DETACHED_TASK_H A work dispatcher runs concurrent tasks.
void WorkRunDetachedTask(Fn &&fn)
Invoke fn asynchronously, discard any errors it produces, and provide no way to wait for it to comple...
Class used to record the end of the error-list.
void Run(Callable &&c, A1 &&a1, A2 &&a2,... AN &&aN)
Add work for the dispatcher to run.
WORK_API bool WorkHasConcurrency()
Return true if WorkGetPhysicalConcurrencyLimit() returns a number greater than 1 and PXR_WORK_THREAD_...
bool Clear() const
Remove all errors in this mark from the error system.