xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCl
XrdClSIDManager.hh
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
// Copyright (c) 2011-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_SID_MANAGER_HH__
20
#define __XRD_CL_SID_MANAGER_HH__
21
22
#include <list>
23
#include <set>
24
#include <stdint.h>
25
#include "
XrdSys/XrdSysPthread.hh
"
26
#include "
XrdCl/XrdClStatus.hh
"
27
28
namespace
XrdCl
29
{
30
//----------------------------------------------------------------------------
32
//----------------------------------------------------------------------------
33
class
SIDManager
34
{
35
public
:
36
37
//------------------------------------------------------------------------
39
//------------------------------------------------------------------------
40
SIDManager
():
pSIDCeiling
(0) {}
41
42
//------------------------------------------------------------------------
47
//------------------------------------------------------------------------
48
Status
AllocateSID
( uint8_t sid[2] );
49
50
//------------------------------------------------------------------------
52
//------------------------------------------------------------------------
53
void
ReleaseSID
( uint8_t sid[2] );
54
55
//------------------------------------------------------------------------
57
//------------------------------------------------------------------------
58
void
TimeOutSID
( uint8_t sid[2] );
59
60
//------------------------------------------------------------------------
62
//------------------------------------------------------------------------
63
bool
IsTimedOut
( uint8_t sid[2] );
64
65
//------------------------------------------------------------------------
67
//------------------------------------------------------------------------
68
void
ReleaseTimedOut
( uint8_t sid[2] );
69
70
//------------------------------------------------------------------------
72
//------------------------------------------------------------------------
73
void
ReleaseAllTimedOut
();
74
75
//------------------------------------------------------------------------
77
//------------------------------------------------------------------------
78
uint32_t
NumberOfTimedOutSIDs
()
const
79
{
80
XrdSysMutexHelper
scopedLock(
pMutex
);
81
return
pTimeOutSIDs
.size();
82
}
83
84
private
:
85
std::list<uint16_t>
pFreeSIDs
;
86
std::set<uint16_t>
pTimeOutSIDs
;
87
uint16_t
pSIDCeiling
;
88
mutable
XrdSysMutex
pMutex
;
89
};
90
}
91
92
#endif // __XRD_CL_SID_MANAGER_HH__
Generated by
1.8.3.1