xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
XrdCl::TaskManager Class Reference

#include <XrdClTaskManager.hh>

Collaboration diagram for XrdCl::TaskManager:
Collaboration graph
[legend]

Classes

struct  TaskHelper
 
struct  TaskHelperCmp
 

Public Member Functions

 TaskManager ()
 Constructor. More...
 
 ~TaskManager ()
 Destructor. More...
 
bool Start ()
 Start the manager. More...
 
bool Stop ()
 
void RegisterTask (Task *task, time_t time, bool own=true)
 
void UnregisterTask (Task *task)
 
void RunTasks ()
 Run the tasks - this loops infinitely. More...
 

Private Types

typedef std::multiset
< TaskHelper, TaskHelperCmp
TaskSet
 
typedef std::list< Task * > TaskList
 

Private Attributes

uint16_t pResolution
 
TaskSet pTasks
 
TaskList pToBeUnregistered
 
pthread_t pRunnerThread
 
bool pRunning
 
XrdSysMutex pMutex
 
XrdSysMutex pOpMutex
 

Detailed Description

Run short tasks at a given time in the future

The task manager just runs one extra thread so the execution of one tasks may interfere with the execution of another

Member Typedef Documentation

typedef std::list<Task*> XrdCl::TaskManager::TaskList
private
typedef std::multiset<TaskHelper, TaskHelperCmp> XrdCl::TaskManager::TaskSet
private

Constructor & Destructor Documentation

XrdCl::TaskManager::TaskManager ( )

Constructor.

XrdCl::TaskManager::~TaskManager ( )

Destructor.

Member Function Documentation

void XrdCl::TaskManager::RegisterTask ( Task task,
time_t  time,
bool  own = true 
)

Run the given task at the given time.

Parameters
tasktask to be run
timetime at which the task should be run
owndetermines whether the task object should be destroyed when no longer needed
void XrdCl::TaskManager::RunTasks ( )

Run the tasks - this loops infinitely.

bool XrdCl::TaskManager::Start ( )

Start the manager.

bool XrdCl::TaskManager::Stop ( )

Stop the manager

Will wait until the currently running task completes

void XrdCl::TaskManager::UnregisterTask ( Task task)

Remove a task, the unregistration process is asynchronous and may be performed at any point in the future, the function just queues the request. Unregistered task gets destroyed if it was owned by the task manager.

Member Data Documentation

XrdSysMutex XrdCl::TaskManager::pMutex
private
XrdSysMutex XrdCl::TaskManager::pOpMutex
private
uint16_t XrdCl::TaskManager::pResolution
private
pthread_t XrdCl::TaskManager::pRunnerThread
private
bool XrdCl::TaskManager::pRunning
private
TaskSet XrdCl::TaskManager::pTasks
private
TaskList XrdCl::TaskManager::pToBeUnregistered
private

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