XRootD
Loading...
Searching...
No Matches
XrdOfsHanXpr Class Reference
Collaboration diagram for XrdOfsHanXpr:

Public Member Functions

 XrdOfsHanXpr (XrdOfsHandle *hP, XrdOfsHanCB *cbP, time_t xtm)
 ~XrdOfsHanXpr ()
void add2Q (int doLK=1)
void Deref ()
void Set (XrdOfsHanCB *cbP, time_t xtm)

Static Public Member Functions

static XrdOfsHanXprGet ()

Friends

class XrdOfsHandle

Detailed Description

Definition at line 161 of file XrdOfsHandle.cc.

Constructor & Destructor Documentation

◆ XrdOfsHanXpr()

XrdOfsHanXpr::XrdOfsHanXpr ( XrdOfsHandle * hP,
XrdOfsHanCB * cbP,
time_t xtm )
inline

Definition at line 176 of file XrdOfsHandle.cc.

177 : Next(0), Handle(hP), Call(cbP), xTime(xtm), xTNew(0) {}

References XrdOfsHandle.

Referenced by add2Q(), and Get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~XrdOfsHanXpr()

XrdOfsHanXpr::~XrdOfsHanXpr ( )
inline

Definition at line 178 of file XrdOfsHandle.cc.

178{}

Member Function Documentation

◆ add2Q()

void XrdOfsHanXpr::add2Q ( int doLK = 1)

Definition at line 781 of file XrdOfsHandle.cc.

782{
783 XrdOfsHanXpr *xPP, *xP;
784
785// Place this object on the deferred queue
786//
787 if (doLK) xqCV.Lock();
788 xPP = 0; xP = xprQ;
789
790 while(xP && xP->xTime < xTime) {xPP = xP; xP = xP->Next;}
791
792 Next = xP;
793 if (xPP) {xPP->Next = this; if (doLK) xqCV.UnLock();}
794 else { xprQ = this; if (doLK) {xqCV.Signal(); xqCV.UnLock();}}
795};
XrdOfsHanXpr(XrdOfsHandle *hP, XrdOfsHanCB *cbP, time_t xtm)

References XrdOfsHanXpr().

Referenced by Get(), and XrdOfsHandle::Retire().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Deref()

void XrdOfsHanXpr::Deref ( )
inline

Definition at line 168 of file XrdOfsHandle.cc.

169 {xqCV.Lock(); Handle=0; Call=0; xTNew=0; xqCV.UnLock();}

◆ Get()

XrdOfsHanXpr * XrdOfsHanXpr::Get ( )
static

Definition at line 801 of file XrdOfsHandle.cc.

802{
803 XrdOfsHanXpr *xP;
804 XrdOfsHandle *hP;
805 int waitTime = 2592000;
806
807// Obtain the xqCV lock as we need it to inspect/modify the queue and elements
808// This lock is automatically released when we wait on the associated condvar.
809//
810 xqCV.Lock();
811
812// Caculate the next wait time based on the first element, if any, in the queue.
813// If the wait time is positive then loop back to wait that amount of time. Note
814// that we have the xqCV lock that is needed to touch an inq Xpr object.
815//
816do{do{if (!(xP = xprQ)) waitTime = 2592000;
817 else waitTime = xP->xTime - time(0);
818 if (waitTime > 0) break;
819 xprQ = xP->Next;
820
821// Get the associated file handle. If none, simply delete the Xpr object.
822//
823 if (!(hP = xP->Handle)) {delete xP; continue;}
824
825// If a new wait time is indicated then reschedule this object
826//
827 if (xP->xTNew)
828 {xP->xTime = xP->xTNew; xP->xTNew = 0;
829 xP->add2Q(0);
830 continue;
831 }
832
833// Since we are still holding the xqCV lock we must get a conditional lock on
834// the handle. If we can't then reschedule this object for later.
835//
836 if (!(hP->WaitLock()))
837 {OfsEroute.Emsg("Retire", "defering retire of", hP->Path.Val);
838 xP->xTime = time(0)+30;
839 xP->add2Q(0);
840 continue;
841 }
842
843// Drop the xqCV lock prior to returning the Xpr object to the caller. The
844// caller will delete the object as needed.
845//
846 xqCV.UnLock();
847 return xP;
848
849 } while(1);
850
851// We have the xqCV lock so we can now wait for an event or a timeout
852//
853 xqCV.Wait(waitTime);
854 } while(1);
855}
XrdSysError OfsEroute
const char * Val
friend class XrdOfsHandle
void add2Q(int doLK=1)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)

References XrdOfsHanXpr(), add2Q(), XrdOfsHandle::Lock(), OfsEroute, XrdOfsHanKey::Val, and XrdOfsHandle.

Referenced by XrdOfsHandle::StartXpr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Set()

void XrdOfsHanXpr::Set ( XrdOfsHanCB * cbP,
time_t xtm )
inline

Definition at line 173 of file XrdOfsHandle.cc.

174 {xqCV.Lock(); Call = cbP; xTNew = xtm; xqCV.UnLock();}

◆ XrdOfsHandle

friend class XrdOfsHandle
friend

Definition at line 163 of file XrdOfsHandle.cc.

References XrdOfsHandle.

Referenced by XrdOfsHanXpr(), Get(), and XrdOfsHandle.


The documentation for this class was generated from the following file: