XRootD
XrdCl::FileTimer Class Reference

Task generating timeout events for FileStateHandlers in recovery mode. More...

#include <XrdClFileTimer.hh>

+ Inheritance diagram for XrdCl::FileTimer:
+ Collaboration diagram for XrdCl::FileTimer:

Public Member Functions

 FileTimer ()
 Constructor. More...
 
virtual ~FileTimer ()
 Destructor. More...
 
void Lock ()
 Lock the task. More...
 
void RegisterFileObject (FileStateHandler *file)
 Register a file state handler. More...
 
virtual time_t Run (time_t now)
 Perform the task's action. More...
 
void UnLock ()
 Un-lock the task. More...
 
void UnRegisterFileObject (FileStateHandler *file)
 Un-register a file state handler. More...
 
- Public Member Functions inherited from XrdCl::Task
virtual ~Task ()
 
const std::string & GetName () const
 Name of the task. More...
 
void SetName (const std::string &name)
 Set name of the task. More...
 

Detailed Description

Task generating timeout events for FileStateHandlers in recovery mode.

Definition at line 32 of file XrdClFileTimer.hh.

Constructor & Destructor Documentation

◆ FileTimer()

XrdCl::FileTimer::FileTimer ( )
inline

Constructor.

Definition at line 38 of file XrdClFileTimer.hh.

39  {
40  SetName( "FileTimer task" );
41  }
void SetName(const std::string &name)
Set name of the task.

References XrdCl::Task::SetName().

+ Here is the call graph for this function:

◆ ~FileTimer()

virtual XrdCl::FileTimer::~FileTimer ( )
inlinevirtual

Destructor.

Definition at line 46 of file XrdClFileTimer.hh.

47  {
48  }

Member Function Documentation

◆ Lock()

void XrdCl::FileTimer::Lock ( )
inline

Lock the task.

Definition at line 71 of file XrdClFileTimer.hh.

72  {
73  pMutex.Lock();
74  }

References XrdSysMutex::Lock().

Referenced by XrdCl::ForkHandler::Prepare().

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

◆ RegisterFileObject()

void XrdCl::FileTimer::RegisterFileObject ( FileStateHandler file)
inline

Register a file state handler.

Definition at line 53 of file XrdClFileTimer.hh.

54  {
55  XrdSysMutexHelper scopedLock( pMutex );
56  pFileObjects.insert( file );
57  }

Referenced by XrdCl::FileStateHandler::FileStateHandler().

+ Here is the caller graph for this function:

◆ Run()

time_t XrdCl::FileTimer::Run ( time_t  now)
virtual

Perform the task's action.

Implements XrdCl::Task.

Definition at line 29 of file XrdClFileTimer.cc.

30  {
31  pMutex.Lock();
32  std::set<FileStateHandler*>::iterator it;
33  for( it = pFileObjects.begin(); it != pFileObjects.end(); ++it )
34  (*it)->Tick(now);
35  pMutex.UnLock();
36  Env *env = DefaultEnv::GetEnv();
37  int timeoutResolution = DefaultTimeoutResolution;
38  env->GetInt( "TimeoutResolution", timeoutResolution );
39  return now+timeoutResolution;
40  }
static Env * GetEnv()
Get default client environment.
const int DefaultTimeoutResolution

References XrdCl::DefaultTimeoutResolution, XrdCl::DefaultEnv::GetEnv(), XrdCl::Env::GetInt(), XrdSysMutex::Lock(), and XrdSysMutex::UnLock().

+ Here is the call graph for this function:

◆ UnLock()

void XrdCl::FileTimer::UnLock ( )
inline

Un-lock the task.

Definition at line 79 of file XrdClFileTimer.hh.

80  {
81  pMutex.UnLock();
82  }

References XrdSysMutex::UnLock().

Referenced by XrdCl::ForkHandler::Child(), and XrdCl::ForkHandler::Parent().

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

◆ UnRegisterFileObject()

void XrdCl::FileTimer::UnRegisterFileObject ( FileStateHandler file)
inline

Un-register a file state handler.

Definition at line 62 of file XrdClFileTimer.hh.

63  {
64  XrdSysMutexHelper scopedLock( pMutex );
65  pFileObjects.erase( file );
66  }

Referenced by XrdCl::FileStateHandler::~FileStateHandler().

+ Here is the caller graph for this function:

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