Definition at line 65 of file XrdWait41.cc.
◆ XrdW41Gate()
XrdW41Gate::XrdW41Gate |
( |
| ) |
|
|
inline |
◆ ~XrdW41Gate()
XrdW41Gate::~XrdW41Gate |
( |
| ) |
|
|
inline |
◆ Serialize()
void XrdW41Gate::Serialize |
( |
XrdOucTList * | gfP, |
|
|
int | Wait = 1 ) |
|
static |
Definition at line 224 of file XrdWait41.cc.
225{
227 int Act, rc;
228
229
230
231 bzero(&lock_args, sizeof(lock_args));
232 lock_args.l_type = F_WRLCK;
233 Act = (Wait ? F_SETLKW : F_SETLK);
234
235
236
237 do {rc = fcntl(gfP->val, Act, &lock_args);} while(rc == -1 && errno == EINTR);
238
239
240
241 if (rc != -1) rc = 0;
242 else {rc = errno;
243 std::cerr <<
"Serialize: " <<
XrdSysE2T(rc) <<
" locking FD " <<gfP->
text <<std::endl;
244 }
245
246
247
249 if (rc || gateOpen)
close(gfP->val);
250 else gateOpen = 1;
253}
const char * XrdSysE2T(int errcode)
References close, FLOCK_t, XrdSysMutex::Lock(), XrdSysSemaphore::Post(), XrdOucTList::text, XrdSysMutex::UnLock(), and XrdSysE2T().
Referenced by XrdWait41::GateWait().
◆ Wait41()
Definition at line 259 of file XrdWait41.cc.
260{
261 static const int AMode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
262 pthread_t tid;
263 const char *eTxt;
264 int rc, Num = 0;
265
266
267
268
269 while(gfP)
270 {if (Num)
272 if (gateOpen) {gateMutex.
UnLock();
return 1;}
274 }
275 if ((gfP->val =
open(gfP->text, O_CREAT|O_RDWR, AMode)) < 0)
277 std::cerr <<"Wait41: " <<eTxt <<" opening " <<gfP->text <<std::endl;
278 }
282 std::cerr <<"Wait41: " <<eTxt <<" creating gate thread for "
283 <<gfP->text <<std::endl;
285 } else Num++;
286 gfP = gfP->next;
287 }
288
289
290
291 while(Num--)
294 if (gateOpen) {gateMutex.
UnLock();
return 1;}
296 }
297
298
299
300 return 0;
301}
#define XRDSYSTHREAD_BIND
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)
void * GateWait(void *parg)
References close, XrdWait41::GateWait(), XrdSysMutex::Lock(), open, XrdSysThread::Run(), XrdOucTList::text, XrdSysMutex::UnLock(), XrdSysSemaphore::Wait(), XrdSysE2T(), and XRDSYSTHREAD_BIND.
Referenced by main().
The documentation for this class was generated from the following file: