XRootD
Loading...
Searching...
No Matches
XrdXrootdTransPend.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* */
3/* X r d X r o o t d B r i d g e . h h */
4/* */
5/* (c) 2012 by the Board of Trustees of the Leland Stanford, Jr., University */
6/* All Rights Reserved */
7/* Produced by Andrew Hanushevsky for Stanford University under contract */
8/* DE-AC02-76-SFO0515 with the Department of Energy */
9/* */
10/* This file is part of the XRootD software suite. */
11/* */
12/* XRootD is free software: you can redistribute it and/or modify it under */
13/* the terms of the GNU Lesser General Public License as published by the */
14/* Free Software Foundation, either version 3 of the License, or (at your */
15/* option) any later version. */
16/* */
17/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20/* License for more details. */
21/* */
22/* You should have received a copy of the GNU Lesser General Public License */
23/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25/* */
26/* The copyright holder's institutional names and contributor's names may not */
27/* be used to endorse or promote products derived from this software without */
28/* specific prior written permission of the institution or contributor. */
29/******************************************************************************/
30
31#include <cstring>
32
35
36/******************************************************************************/
37/* S t a t i c M e m b e r s */
38/******************************************************************************/
39
40XrdSysMutex XrdXrootdTransPend::myMutex;
41
42XrdXrootdTransPend *XrdXrootdTransPend::rqstQ = 0;
43
44/******************************************************************************/
45/* C l e a r */
46/******************************************************************************/
47
49{
50 XrdXrootdTransPend *tpP, *tpN, *tpX;
51
52// Lock this operations
53//
54 myMutex.Lock();
55
56// Run through the queue deleting all elements owned by the transit object
57//
58 tpP = 0; tpN = rqstQ;
59 while(tpN)
60 {if (tpN->bridge == trP)
61 {if (tpP) tpP->next = tpN->next;
62 else rqstQ = tpN->next;
63 tpX = tpN; tpN = tpN->next; delete tpX;
64 } else {
65 tpP = tpN; tpN = tpN->next;
66 }
67 }
68
69// All done
70//
71 myMutex.UnLock();
72}
73
74/******************************************************************************/
75/* Q u e u e */
76/******************************************************************************/
77
79{
80// Now place it on out pending queue
81//
82 myMutex.Lock();
83 next = rqstQ; rqstQ = this;
84 myMutex.UnLock();
85}
86
87/******************************************************************************/
88/* R e m o v e */
89/******************************************************************************/
90
92{
93 XrdXrootdTransPend *tpP, *tpN;
94
95// Lock this operations
96//
97 myMutex.Lock();
98
99// Run through the queue and remove matching element
100//
101 tpP = 0; tpN = rqstQ;
102 while(tpN)
103 {if (tpN->link == lP && tpN->Pend.theSid == sid)
104 {if (tpP) tpP->next = tpN->next;
105 else rqstQ = tpN->next;
106 break;
107 } else {
108 tpP = tpN; tpN = tpN->next;
109 }
110 }
111
112// All done
113//
114 myMutex.UnLock();
115 return tpN;
116}
union XrdXrootdTransPend::@182 Pend
static XrdXrootdTransPend * Remove(XrdLink *lP, short sid)
XrdXrootdTransPend * next
XrdXrootdTransit * bridge
static void Clear(XrdXrootdTransit *trP)