XRootD
XrdEc::ThreadPool Class Reference

#include <XrdEcThreadPool.hh>

+ Collaboration diagram for XrdEc::ThreadPool:

Public Member Functions

 ~ThreadPool ()
 Destructor. More...
 
template<typename FUNC , typename ... ARGs>
std::future< std::invoke_result_t< FUNC, ARGs... > > Execute (FUNC func, ARGs... args)
 Schedule a functional (together with its arguments) for execution. More...
 

Static Public Member Functions

static ThreadPoolInstance ()
 Singleton access. More...
 

Detailed Description

Definition at line 38 of file XrdEcThreadPool.hh.

Constructor & Destructor Documentation

◆ ~ThreadPool()

XrdEc::ThreadPool::~ThreadPool ( )
inline

Destructor.

Definition at line 143 of file XrdEcThreadPool.hh.

144  {
145  threadpool.Stop();
146  threadpool.Finalize();
147  }
bool Finalize()
Finalize the job manager, clear the queues.
bool Stop()
Stop the workers.

References XrdCl::JobManager::Finalize(), and XrdCl::JobManager::Stop().

+ Here is the call graph for this function:

Member Function Documentation

◆ Execute()

template<typename FUNC , typename ... ARGs>
std::future<std::invoke_result_t<FUNC, ARGs...> > XrdEc::ThreadPool::Execute ( FUNC  func,
ARGs...  args 
)
inline

Schedule a functional (together with its arguments) for execution.

Definition at line 163 of file XrdEcThreadPool.hh.

164  {
165  using RET = std::invoke_result_t<FUNC, ARGs...>;
166  auto *job = new AnyJob<FUNC, RET, ARGs...>( func, std::move( args )... );
167  std::future<RET> ftr = job->GetFuture();
168  threadpool.QueueJob( job, nullptr );
169  return ftr;
170  }
void QueueJob(Job *job, void *arg=0)
Add a job to be run.

References XrdCl::JobManager::QueueJob().

Referenced by XrdEc::WrtBuff::Encode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Instance()

static ThreadPool& XrdEc::ThreadPool::Instance ( )
inlinestatic

Singleton access.

Definition at line 152 of file XrdEcThreadPool.hh.

153  {
154  static ThreadPool instance;
155  return instance;
156  }

Referenced by XrdEc::WrtBuff::Encode().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: