xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCl
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__
Generated by
1.8.3.1