15#include "RConfigure.h"
25#if !defined(__ROOTCLING__) && !defined(G__DICTIONARY)
26#error "Cannot use ROOT::Experimental::Async without defining R__USE_IMT."
33namespace Experimental {
47 std::unique_ptr<TTaskGroup>
fTg{
nullptr};
78namespace Experimental {
84 template <
class Function,
class... Args>
86 typename std::result_of<typename std::decay<Function>::type(
typename std::decay<Args>::type...)>
::type>
90 TFuture(std::future<T> &&fut, std::unique_ptr<TTaskGroup> &&tg)
91 :
ROOT::Detail::
TFutureImpl<T>(std::forward<std::future<T>>(fut), std::move(tg)){};
106 template <
class Function,
class... Args>
108 typename std::result_of<typename std::decay<Function>::type(
typename std::decay<Args>::type...)>
::type>
112 TFuture(std::future<void> &&fut, std::unique_ptr<TTaskGroup> &&tg)
127 template <
class Function,
class... Args>
129 typename std::result_of<typename std::decay<Function>::type(
typename std::decay<Args>::type...)>
::type>
133 TFuture(std::future<T &> &&fut, std::unique_ptr<TTaskGroup> &&tg)
134 :
ROOT::Detail::TFutureImpl<
T &>(std::
forward<std::future<
T &>>(fut), std::move(tg)){};
137 TFuture(std::future<T &> &&fut) :
ROOT::Detail::TFutureImpl<
T &>(std::
forward<std::future<
T &>>(fut)){};
142 return this->fStdFut.get();
150template <
class Function,
class... Args>
151TFuture<typename std::result_of<typename std::decay<Function>::type(
typename std::decay<Args>::type...)>
::type>
158 using Ret_t =
typename std::result_of<typename std::decay<Function>::type(
typename std::decay<Args>::type...)>
::type;
160 auto thisPt = std::make_shared<std::packaged_task<Ret_t()>>(std::bind(
f, args...));
162 tg->Run([thisPt]() { (*thisPt)(); });
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
Double_t(* Function)(Double_t)
TFutureImpl(std::future< T > &&fut, std::unique_ptr< TTaskGroup > &&tg)
friend class Experimental::TFuture
TFutureImpl< T > & operator=(TFutureImpl< T > &other)=delete
TFutureImpl & operator=(std::future< T > &&other)
TFutureImpl(const TFutureImpl< T > &other)=delete
TFutureImpl< T > & operator=(TFutureImpl< T > &&other)=default
TFutureImpl(TFutureImpl< T > &&other)
TFutureImpl(std::future< T > &&fut)
std::unique_ptr< TTaskGroup > fTg
A TFuture class. It can wrap an std::future.
TFuture(std::future< T > &&fut)
TFuture(std::future< T > &&fut, std::unique_ptr< TTaskGroup > &&tg)
friend TFuture< typename std::result_of< typename std::decay< Function >::type(typename std::decay< Args >::type...)>::type > Async(Function &&f, Args &&... args)
Runs a function asynchronously potentially in a new thread and returns a ROOT TFuture that will hold ...
A class to manage the asynchronous execution of work items.
TFuture< typename std::result_of< typename std::decay< Function >::type(typename std::decay< Args >::type...)>::type > Async(Function &&f, Args &&... args)
Runs a function asynchronously potentially in a new thread and returns a ROOT TFuture that will hold ...
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
void forward(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData)
apply the weights (and functions) in forward direction of the DNN