XRootD
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
22
#include <
XrdSys/XrdSysPthread.hh
>
23
#include <set>
24
25
namespace
XrdCl
26
{
27
class
FileStateHandler;
28
class
FileSystem;
29
class
PostMaster;
30
class
FileTimer;
31
32
//----------------------------------------------------------------------------
33
// Helper class for handling forking
34
//----------------------------------------------------------------------------
35
class
ForkHandler
36
{
37
public
:
38
ForkHandler
();
39
40
//------------------------------------------------------------------------
42
//------------------------------------------------------------------------
43
void
RegisterFileObject
(
FileStateHandler
*file )
44
{
45
XrdSysMutexHelper
scopedLock( pMutex );
46
pFileObjects.insert( file );
47
}
48
49
//------------------------------------------------------------------------
50
// Un-register a file object
51
//------------------------------------------------------------------------
52
void
UnRegisterFileObject
(
FileStateHandler
*file )
53
{
54
XrdSysMutexHelper
scopedLock( pMutex );
55
pFileObjects.erase( file );
56
}
57
58
//------------------------------------------------------------------------
59
// Register a file system object
60
//------------------------------------------------------------------------
61
void
RegisterFileSystemObject
(
FileSystem
*fs )
62
{
63
XrdSysMutexHelper
scopedLock( pMutex );
64
pFileSystemObjects.insert( fs );
65
}
66
67
//------------------------------------------------------------------------
69
//------------------------------------------------------------------------
70
void
UnRegisterFileSystemObject
(
FileSystem
*fs )
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;
109
PostMaster
*pPostMaster;
110
FileTimer
*pFileTimer;
111
XrdSysMutex
pMutex;
112
};
113
}
114
115
#endif
// __XRD_CL_FORK_HANDLER_HH__
XrdSysPthread.hh
XrdCl::FileStateHandler
Handle the stateful operations.
Definition:
XrdClFileStateHandler.hh:80
XrdCl::FileSystem
Send file/filesystem queries to an XRootD cluster.
Definition:
XrdClFileSystem.hh:203
XrdCl::FileTimer
Task generating timeout events for FileStateHandlers in recovery mode.
Definition:
XrdClFileTimer.hh:33
XrdCl::ForkHandler
Definition:
XrdClForkHandler.hh:36
XrdCl::ForkHandler::Parent
void Parent()
Handle the parent post-fork.
Definition:
XrdClForkHandler.cc:72
XrdCl::ForkHandler::Prepare
void Prepare()
Handle the preparation part of the forking process.
Definition:
XrdClForkHandler.cc:40
XrdCl::ForkHandler::Child
void Child()
Handler the child post-fork.
Definition:
XrdClForkHandler.cc:102
XrdCl::ForkHandler::RegisterFileTimer
void RegisterFileTimer(FileTimer *fileTimer)
Definition:
XrdClForkHandler.hh:85
XrdCl::ForkHandler::ForkHandler
ForkHandler()
Definition:
XrdClForkHandler.cc:32
XrdCl::ForkHandler::RegisterFileSystemObject
void RegisterFileSystemObject(FileSystem *fs)
Definition:
XrdClForkHandler.hh:61
XrdCl::ForkHandler::RegisterFileObject
void RegisterFileObject(FileStateHandler *file)
Register a file object.
Definition:
XrdClForkHandler.hh:43
XrdCl::ForkHandler::UnRegisterFileObject
void UnRegisterFileObject(FileStateHandler *file)
Definition:
XrdClForkHandler.hh:52
XrdCl::ForkHandler::RegisterPostMaster
void RegisterPostMaster(PostMaster *postMaster)
Register a post master object.
Definition:
XrdClForkHandler.hh:79
XrdCl::ForkHandler::UnRegisterFileSystemObject
void UnRegisterFileSystemObject(FileSystem *fs)
Un-register a file system object.
Definition:
XrdClForkHandler.hh:70
XrdCl::PostMaster
A hub for dispatching and receiving messages.
Definition:
XrdClPostMaster.hh:48
XrdSysMutexHelper
Definition:
XrdSysPthread.hh:263
XrdSysMutex
Definition:
XrdSysPthread.hh:165
XrdCl
Definition:
XrdClAction.hh:34
XrdCl
XrdClForkHandler.hh
Generated by
1.9.1