Loading...
Searching...
No Matches
detachedTask_impl.h
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>
11#include "pxr/base/work/workTBB/dispatcher_impl.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
23PXR_NAMESPACE_OPEN_SCOPE
24
25class WorkImpl_Dispatcher;
26
27WORK_API
28WorkImpl_Dispatcher & WorkTBB_GetDetachedDispatcher();
29
30WORK_API
31void WorkTBB_EnsureDetachedTaskProgress();
32
35template <class Fn>
36inline void WorkImpl_RunDetachedTask(Fn &&fn){
37 WorkTBB_GetDetachedDispatcher().Run(std::forward<Fn>(fn));
38 WorkTBB_EnsureDetachedTaskProgress();
39}
40
41PXR_NAMESPACE_CLOSE_SCOPE
42
43#endif // PXR_BASE_WORK_TBB_DETACHED_TASK_IMPL_H