xrootd
Loading...
Searching...
No Matches
XrdClFileTimer.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// Copyright (c) 2013 by European Organization for Nuclear Research (CERN)
3// Author: Lukasz Janyst <ljanyst@cern.ch>
4//------------------------------------------------------------------------------
5// XRootD is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// XRootD is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17//------------------------------------------------------------------------------
18
19#ifndef __XRD_CL_FILE_TIMER_HH__
20#define __XRD_CL_FILE_TIMER_HH__
21
24
25namespace XrdCl
26{
27 class FileStateHandler;
28
29 //----------------------------------------------------------------------------
31 //----------------------------------------------------------------------------
32 class FileTimer: public Task
33 {
34 public:
35 //------------------------------------------------------------------------
37 //------------------------------------------------------------------------
39 {
40 SetName( "FileTimer task" );
41 }
42
43 //------------------------------------------------------------------------
45 //------------------------------------------------------------------------
46 virtual ~FileTimer()
47 {
48 }
49
50 //------------------------------------------------------------------------
52 //------------------------------------------------------------------------
54 {
55 XrdSysMutexHelper scopedLock( pMutex );
56 pFileObjects.insert( file );
57 }
58
59 //------------------------------------------------------------------------
61 //------------------------------------------------------------------------
63 {
64 XrdSysMutexHelper scopedLock( pMutex );
65 pFileObjects.erase( file );
66 }
67
68 //------------------------------------------------------------------------
70 //------------------------------------------------------------------------
71 void Lock()
72 {
73 pMutex.Lock();
74 }
75
76 //------------------------------------------------------------------------
78 //------------------------------------------------------------------------
79 void UnLock()
80 {
81 pMutex.UnLock();
82 }
83
84 //------------------------------------------------------------------------
86 //------------------------------------------------------------------------
87 virtual time_t Run( time_t now );
88
89 private:
90 std::set<FileStateHandler*> pFileObjects;
92 };
93}
94
95#endif // __XRD_CL_FILE_TIMER_HH__
Handle the stateful operations.
Definition XrdClFileStateHandler.hh:80
Task generating timeout events for FileStateHandlers in recovery mode.
Definition XrdClFileTimer.hh:33
FileTimer()
Constructor.
Definition XrdClFileTimer.hh:38
void UnRegisterFileObject(FileStateHandler *file)
Un-register a file state handler.
Definition XrdClFileTimer.hh:62
virtual ~FileTimer()
Destructor.
Definition XrdClFileTimer.hh:46
virtual time_t Run(time_t now)
Perform the task's action.
void Lock()
Lock the task.
Definition XrdClFileTimer.hh:71
void RegisterFileObject(FileStateHandler *file)
Register a file state handler.
Definition XrdClFileTimer.hh:53
XrdSysMutex pMutex
Definition XrdClFileTimer.hh:91
std::set< FileStateHandler * > pFileObjects
Definition XrdClFileTimer.hh:90
void UnLock()
Un-lock the task.
Definition XrdClFileTimer.hh:79
Interface for a task to be run by the TaskManager.
Definition XrdClTaskManager.hh:36
void SetName(const std::string &name)
Set name of the task.
Definition XrdClTaskManager.hh:60
Definition XrdSysPthread.hh:263
Definition XrdSysPthread.hh:165
void Lock()
Definition XrdSysPthread.hh:222
void UnLock()
Definition XrdSysPthread.hh:224
Definition XrdClAction.hh:34