xrootd
Loading...
Searching...
No Matches
XrdClForkHandler.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// Copyright (c) 2012 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_FORK_HANDLER_HH__
20#define __XRD_CL_FORK_HANDLER_HH__
21
23#include <set>
24
25namespace XrdCl
26{
27 class FileStateHandler;
28 class FileSystem;
29 class PostMaster;
30 class FileTimer;
31
32 //----------------------------------------------------------------------------
33 // Helper class for handling forking
34 //----------------------------------------------------------------------------
36 {
37 public:
39
40 //------------------------------------------------------------------------
42 //------------------------------------------------------------------------
44 {
45 XrdSysMutexHelper scopedLock( pMutex );
46 pFileObjects.insert( file );
47 }
48
49 //------------------------------------------------------------------------
50 // Un-register a file object
51 //------------------------------------------------------------------------
53 {
54 XrdSysMutexHelper scopedLock( pMutex );
55 pFileObjects.erase( file );
56 }
57
58 //------------------------------------------------------------------------
59 // Register a file system object
60 //------------------------------------------------------------------------
62 {
63 XrdSysMutexHelper scopedLock( pMutex );
64 pFileSystemObjects.insert( fs );
65 }
66
67 //------------------------------------------------------------------------
69 //------------------------------------------------------------------------
71 {
72 XrdSysMutexHelper scopedLock( pMutex );
73 pFileSystemObjects.erase( fs );
74 }
75
76 //------------------------------------------------------------------------
78 //------------------------------------------------------------------------
79 void RegisterPostMaster( PostMaster *postMaster )
80 {
81 XrdSysMutexHelper scopedLock( pMutex );
82 pPostMaster = postMaster;
83 }
84
85 void RegisterFileTimer( FileTimer *fileTimer )
86 {
87 XrdSysMutexHelper scopedLock( pMutex );
88 pFileTimer = fileTimer;
89 }
90
91 //------------------------------------------------------------------------
93 //------------------------------------------------------------------------
94 void Prepare();
95
96 //------------------------------------------------------------------------
98 //------------------------------------------------------------------------
99 void Parent();
100
101 //------------------------------------------------------------------------
103 //------------------------------------------------------------------------
104 void Child();
105
106 private:
107 std::set<FileStateHandler*> pFileObjects;
108 std::set<FileSystem*> pFileSystemObjects;
112 };
113}
114
115#endif // __XRD_CL_FORK_HANDLER_HH__
Handle the stateful operations.
Definition XrdClFileStateHandler.hh:80
Send file/filesystem queries to an XRootD cluster.
Definition XrdClFileSystem.hh:203
Task generating timeout events for FileStateHandlers in recovery mode.
Definition XrdClFileTimer.hh:33
Definition XrdClForkHandler.hh:36
void Parent()
Handle the parent post-fork.
XrdSysMutex pMutex
Definition XrdClForkHandler.hh:111
void Prepare()
Handle the preparation part of the forking process.
void Child()
Handler the child post-fork.
void RegisterFileTimer(FileTimer *fileTimer)
Definition XrdClForkHandler.hh:85
void RegisterFileSystemObject(FileSystem *fs)
Definition XrdClForkHandler.hh:61
std::set< FileStateHandler * > pFileObjects
Definition XrdClForkHandler.hh:107
FileTimer * pFileTimer
Definition XrdClForkHandler.hh:110
PostMaster * pPostMaster
Definition XrdClForkHandler.hh:109
void RegisterFileObject(FileStateHandler *file)
Register a file object.
Definition XrdClForkHandler.hh:43
void UnRegisterFileObject(FileStateHandler *file)
Definition XrdClForkHandler.hh:52
void RegisterPostMaster(PostMaster *postMaster)
Register a post master object.
Definition XrdClForkHandler.hh:79
void UnRegisterFileSystemObject(FileSystem *fs)
Un-register a file system object.
Definition XrdClForkHandler.hh:70
std::set< FileSystem * > pFileSystemObjects
Definition XrdClForkHandler.hh:108
A hub for dispatching and receiving messages.
Definition XrdClPostMaster.hh:48
Definition XrdSysPthread.hh:263
Definition XrdSysPthread.hh:165
Definition XrdClAction.hh:34