XRootD
Loading...
Searching...
No Matches
XrdFrmReqBoss Class Reference

#include <XrdFrmReqBoss.hh>

+ Collaboration diagram for XrdFrmReqBoss:

Public Member Functions

 XrdFrmReqBoss (const char *Me, int qVal)
 
 ~XrdFrmReqBoss ()
 
void Add (XrdFrcRequest &Request)
 
void Del (XrdFrcRequest &Request)
 
void Process ()
 
int Server ()
 
int Start (char *aPath, int aMode)
 
void Wakeup (int PushIt=1)
 

Detailed Description

Definition at line 37 of file XrdFrmReqBoss.hh.

Constructor & Destructor Documentation

◆ XrdFrmReqBoss()

XrdFrmReqBoss::XrdFrmReqBoss ( const char *  Me,
int  qVal 
)
inline

Definition at line 53 of file XrdFrmReqBoss.hh.

54 : rqReady(0),Persona(Me),theQ(qVal),isPosted(0) {}

◆ ~XrdFrmReqBoss()

XrdFrmReqBoss::~XrdFrmReqBoss ( )
inline

Definition at line 55 of file XrdFrmReqBoss.hh.

55{}

Member Function Documentation

◆ Add()

void XrdFrmReqBoss::Add ( XrdFrcRequest Request)

Definition at line 66 of file XrdFrmReqBoss.cc.

67{
68
69// Complete the request including verifying the priority
70//
71 if (Request.Prty > XrdFrcRequest::maxPrty)
73 else if (Request.Prty < 0)Request.Prty = 0;
74 Request.addTOD = time(0);
75
76// Now add it to the queue
77//
78 rQueue[static_cast<int>(Request.Prty)]->Add(&Request);
79
80// Now wake ourselves up
81//
82 Wakeup(1);
83}
signed char Prty
static const int maxPrty
long long addTOD
void Add(XrdFrcRequest &Request)
void Wakeup(int PushIt=1)

References Add(), XrdFrcRequest::addTOD, XrdFrcRequest::maxPrty, XrdFrcRequest::Prty, and Wakeup().

Referenced by Add().

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

◆ Del()

void XrdFrmReqBoss::Del ( XrdFrcRequest Request)

Definition at line 89 of file XrdFrmReqBoss.cc.

90{
91 int i;
92
93// Remove all pending requests for this id
94//
95 for (i = 0; i <= XrdFrcRequest::maxPrty; i++) rQueue[i]->Can(&Request);
96}

References XrdFrcRequest::maxPrty.

◆ Process()

void XrdFrmReqBoss::Process ( )

Definition at line 102 of file XrdFrmReqBoss.cc.

103{
104 EPNAME("Process");
105 XrdFrcRequest myReq;
106 int i, rc, numXfr, numPull;;
107
108// Perform staging in an endless loop
109//
110do{Wakeup(0);
111 do{numXfr = 0;
112 for (i = XrdFrcRequest::maxPrty; i >= 0; i--)
113 {numPull = i+1;
114 while(numPull && (rc = rQueue[i]->Get(&myReq)))
115 {if (myReq.Options & XrdFrcRequest::Register) Register(myReq,i);
116 else {numPull -= XrdFrmXfrQueue::Add(&myReq,rQueue[i],theQ);
117 numXfr++;
118 DEBUG(Persona <<" from Q " << i <<' ' <<numPull <<" left");
119 if (rc < 0) break;
120 }
121 }
122 }
123 } while(numXfr);
124 } while(1);
125}
#define DEBUG(x)
#define EPNAME(x)
static const int Register
static int Add(XrdFrcRequest *rP, XrdFrcReqFile *reqF, int theQ)

References XrdFrmXfrQueue::Add(), DEBUG, EPNAME, XrdFrcRequest::maxPrty, XrdFrcRequest::Options, XrdFrcRequest::Register, and Wakeup().

Referenced by mainServerXeq().

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

◆ Server()

int XrdFrmReqBoss::Server ( )

◆ Start()

int XrdFrmReqBoss::Start ( char *  aPath,
int  aMode 
)

Definition at line 154 of file XrdFrmReqBoss.cc.

155{
156 pthread_t tid;
157 char buff[2048], *qPath;
158 int retc, i;
159
160// Generate the queue directory path
161//
162 if (!(qPath = XrdFrcUtils::makeQDir(aPath, aMode))) return 0;
163
164// Initialize the request queues if all went well
165//
166 for (i = 0; i <= XrdFrcRequest::maxPrty; i++)
167 {sprintf(buff, "%s%sQ.%d", qPath, Persona, i);
168 rQueue[i] = new XrdFrcReqFile(buff, 0);
169 if (!rQueue[i]->Init()) {free(qPath); return 0;}
170 }
171 free(qPath);
172
173// Start the request processing thread
174//
175 if ((retc = XrdSysThread::Run(&tid, mainServerXeq, (void *)this,
176 XRDSYSTHREAD_BIND, Persona)))
177 {sprintf(buff, "create %s request thread", Persona);
178 Say.Emsg("Start", retc, buff);
179 return 0;
180 }
181
182// All done
183//
184 return 1;
185}
XrdOucPup XrdCmsParser::Pup & Say
void * mainServerXeq(void *parg)
#define XRDSYSTHREAD_BIND
static char * makeQDir(const char *Path, int Mode)
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)

References mainServerXeq(), XrdFrcUtils::makeQDir(), XrdFrcRequest::maxPrty, XrdSysThread::Run(), Say, and XRDSYSTHREAD_BIND.

Referenced by XrdFrmXfrDaemon::Init().

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

◆ Wakeup()

void XrdFrmReqBoss::Wakeup ( int  PushIt = 1)

Definition at line 191 of file XrdFrmReqBoss.cc.

192{
193 static XrdSysMutex rqMutex;
194
195// If this is a PushIt then see if we need to push the binary semaphore
196//
197 if (PushIt) {rqMutex.Lock();
198 if (!isPosted) {rqReady.Post(); isPosted = 1;}
199 rqMutex.UnLock();
200 }
201 else {rqReady.Wait();
202 rqMutex.Lock(); isPosted = 0; rqMutex.UnLock();
203 }
204}

References XrdSysMutex::Lock(), XrdSysSemaphore::Post(), XrdSysMutex::UnLock(), and XrdSysSemaphore::Wait().

Referenced by Add(), XrdFrmXfrDaemon::Pong(), Process(), and XrdFrmXfrDaemon::Start().

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

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