24 #ifndef PXR_BASE_WORK_UTILS_H
25 #define PXR_BASE_WORK_UTILS_H
30 #include "pxr/base/work/api.h"
35 PXR_NAMESPACE_OPEN_SCOPE
38 bool Work_ShouldSynchronizeAsyncDestroyCalls();
41 struct Work_AsyncMoveDestroyHelper {
42 void operator()()
const { }
49 struct Work_AsyncSwapDestroyHelper {
50 Work_AsyncSwapDestroyHelper() =
default;
52 Work_AsyncSwapDestroyHelper(Work_AsyncSwapDestroyHelper
const&) =
delete;
53 Work_AsyncSwapDestroyHelper& operator=(
54 Work_AsyncSwapDestroyHelper
const&) =
delete;
56 Work_AsyncSwapDestroyHelper(Work_AsyncSwapDestroyHelper &&other)
63 Work_AsyncSwapDestroyHelper& operator=(
64 Work_AsyncSwapDestroyHelper &&other)
71 void operator()()
const { }
86 Work_AsyncSwapDestroyHelper<T> helper;
87 swap(helper.obj, obj);
88 if (!Work_ShouldSynchronizeAsyncDestroyCalls())
97 Work_AsyncMoveDestroyHelper<T> helper { std::move(obj) };
98 if (!Work_ShouldSynchronizeAsyncDestroyCalls())
102 PXR_NAMESPACE_CLOSE_SCOPE
104 #endif // PXR_BASE_WORK_UTILS_H
void swap(ArAssetInfo &lhs, ArAssetInfo &rhs)
void WorkRunDetachedTask(Fn &&fn)
Invoke fn asynchronously, discard any errors it produces, and provide no way to wait for it to comple...
void swap(UsdStageLoadRules &l, UsdStageLoadRules &r)
Swap the contents of rules l and r.
void WorkSwapDestroyAsync(T &obj)
Swap obj with a default-constructed T instance, return and arrange for the swapped-out instance to be...
void WorkMoveDestroyAsync(T &obj)
Like WorkSwapDestroyAsync() but instead, move from obj, leaving it in a moved-from state instead of a...