#include <XrdBwmPolicy1.hh>
Definition at line 36 of file XrdBwmPolicy1.hh.
◆ Flow
◆ XrdBwmPolicy1()
XrdBwmPolicy1::XrdBwmPolicy1 |
( |
int | inslots, |
|
|
int | outslots ) |
Definition at line 39 of file XrdBwmPolicy1.cc.
40{
41
42
43 theQ[
In ].maxSlots = theQ[
In ].curSlots = inslots;
44 theQ[
Out].maxSlots = theQ[
Out].curSlots = outslots;
45 theQ[
Xeq].maxSlots = theQ[
Xeq].curSlots = 0;
46 refID = 1;
47}
References In, Out, and Xeq.
◆ ~XrdBwmPolicy1()
XrdBwmPolicy1::~XrdBwmPolicy1 |
( |
| ) |
|
|
inline |
◆ Dispatch()
int XrdBwmPolicy1::Dispatch |
( |
char * | RespBuff, |
|
|
int | RespSize ) |
|
virtual |
Implements XrdBwmPolicy.
Definition at line 53 of file XrdBwmPolicy1.cc.
54{
56 int rID;
57
58
59
60 do {pMutex.Lock();
61 if ((rP = theQ[
In].Next()) || (rP = theQ[
Out].Next()))
63 rID = rP->refID; *RespBuff = '\0';
64 pMutex.UnLock();
65 return rID;
66 }
67 pMutex.UnLock();
68 pSem.Wait();
69 } while(1);
70
71
72
73 strcpy(RespBuff, "Fatal logic error!");
74 return 0;
75}
References In, Out, XrdBwmPolicy1::refReq::refID, and Xeq.
◆ Done()
int XrdBwmPolicy1::Done |
( |
int | rHandle | ) |
|
|
virtual |
Implements XrdBwmPolicy.
Definition at line 81 of file XrdBwmPolicy1.cc.
82{
84 int rc;
85
86
87
88 if (rHandle < 0) rHandle = -rHandle;
89
90
91
92 pMutex.Lock();
93 if ((rP = theQ[
Xeq].Yank(rHandle)))
94 {if (theQ[rP->Way].curSlots++ == 0) pSem.Post();
95 rc = 1;
96 } else {
97 if ((rP=theQ[
In].Yank(rHandle)) || (rP=theQ[
Out].Yank(rHandle))) rc = -1;
98 else rc = 0;
99 }
100 pMutex.UnLock();
101
102
103
104 if (rP) delete rP;
105 return rc;
106}
References In, Out, XrdBwmPolicy1::refReq::Way, and Xeq.
◆ Schedule()
int XrdBwmPolicy1::Schedule |
( |
char * | RespBuff, |
|
|
int | RespSize, |
|
|
SchedParms & | Parms ) |
|
virtual |
Implements XrdBwmPolicy.
Definition at line 112 of file XrdBwmPolicy1.cc.
113{
114 static const char *theWay[] = {"Incoming", "Outgoing"};
116 int myID;
117
118
119
120 *RespBuff = '\0';
121 pMutex.Lock();
122 myID = ++refID;
123 rP =
new refReq(myID, Parms.Direction);
124
125
126
127 if (theQ[rP->Way].curSlots > 0)
128 {theQ[rP->Way].curSlots--;
130 }
131 else if (theQ[rP->Way].maxSlots)
132 {theQ[rP->Way].Add(rP); myID = -myID;}
133 else {strcpy(RespBuff, theWay[rP->Way]);
134 strcat(RespBuff, " requests are not allowed.");
135 delete rP;
136 myID = 0;
137 }
138
139
140
141 pMutex.UnLock();
142 return myID;
143}
References XrdBwmPolicy::SchedParms::Direction, XrdBwmPolicy1::refReq::Way, and Xeq.
◆ Status()
void XrdBwmPolicy1::Status |
( |
int & | numqIn, |
|
|
int & | numqOut, |
|
|
int & | numXeq ) |
|
virtual |
Implements XrdBwmPolicy.
Definition at line 149 of file XrdBwmPolicy1.cc.
150{
151
152
153
154 pMutex.Lock();
155 numqIn = theQ[
In ].Num;
156 numqOut = theQ[
Out].Num;
157 numXeq = theQ[
Xeq].Num;
158 pMutex.UnLock();
159}
References In, Out, and Xeq.
The documentation for this class was generated from the following files: