HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
detachedTask_impl.h
Go to the documentation of this file.
1 //
2 // Copyright 2025 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_BASE_WORK_TBB_DETACHED_TASK_IMPL_H
8 #define PXR_BASE_WORK_TBB_DETACHED_TASK_IMPL_H
9 
10 #include <tbb/blocked_range.h>
12 #include "pxr/base/work/api.h"
13 
14 #if TBB_INTERFACE_VERSION_MAJOR >= 12
15 #include <tbb/task_group.h>
16 #else
17 #include <tbb/task.h>
18 #endif
19 
20 #include <type_traits>
21 #include <utility>
22 
24 
26 
27 WORK_API
29 
32 
33 /// Invoke \p fn asynchronously, discard any errors it produces, and provide
34 /// no way to wait for it to complete.
35 template <class Fn>
36 inline void WorkImpl_RunDetachedTask(Fn &&fn){
37  WorkTBB_GetDetachedDispatcher().Run(std::forward<Fn>(fn));
39 }
40 
42 
43 #endif // PXR_BASE_WORK_TBB_DETACHED_TASK_IMPL_H
#define PXR_NAMESPACE_OPEN_SCOPE
Definition: pxr.h:73
#define WORK_API
Definition: api.h:23
void Run(Callable &&c)
WORK_API WorkImpl_Dispatcher & WorkTBB_GetDetachedDispatcher()
WORK_API void WorkTBB_EnsureDetachedTaskProgress()
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
void WorkImpl_RunDetachedTask(Fn &&fn)