xrootd
|
#include <XrdOucSid.hh>
Classes | |
union | theSid |
The type to pass to Obtain(). Simply cast the char[2] to (theSid *). More... | |
Public Member Functions | |
bool | Obtain (theSid *sidP) |
bool | Release (theSid *sidP) |
void | Reset () |
XrdOucSid (int numSid=256, bool mtproof=true, XrdOucSid *glblSid=0) | |
~XrdOucSid () | |
Private Attributes | |
XrdSysMutex | sidMutex |
XrdOucSid * | globalSid |
unsigned char * | sidVec |
int | sidFree |
int | sidSize |
int | sidMax |
bool | sidLock |
This class implements a fast bit vector based stream ID generator. When stream ID's are generated on a connection basis, each connection can allocate a local SID object sizing the bit vector to match the expected number of simultaneous stream ID's in order to save memory. In order to accomodate overflows, the local object can be initialized with a global SID object that be used to obtain stream ID's when the local object runs out. See the constructor description for the details.
XrdOucSid::XrdOucSid | ( | int | numSid = 256 , |
bool | mtproof = true , |
||
XrdOucSid * | glblSid = 0 |
||
) |
Constructor
numSid | the maximum number of stream ID's that this object can allocate. The value is rounded up to the next multiple of eight. Every 8 ID's requires one byte of memory. Normally, stream ID's range from 0 to 32767, though technically can go to 64K-1 but are then represented as a negative short. |
mtproof | When true (the default) the object obtains a lock before doing any operations. When false, it does not and must be protected, if need be, by some other serialization. |
glblSid | a pointer to another SID object that can be used to obtain stream ID's should this object run out of them. Typically, this is a global pool of stream ID's. |
XrdOucSid::~XrdOucSid | ( | ) |
Destructor. Only this object is destroyed. The global object, if any, is not alteered in any way.
bool XrdOucSid::Obtain | ( | theSid * | sidP | ) |
Obtain a stream ID. When not needed use Release() to recycle them.
sidP | -> the place where the new stream ID is to be placed. |
Referenced by XrdPssUrlInfo::setID().
bool XrdOucSid::Release | ( | theSid * | sidP | ) |
Release a stream ID using the stream ID value.
sidP | -> to the stream ID cast as a theSid pointer. |
Referenced by XrdPssUrlInfo::~XrdPssUrlInfo().
void XrdOucSid::Reset | ( | ) |
Unassign all stream ID's as if the object were newly allocated. Any global stream ID object associated with this object is not reset.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |