XRootD
XrdSsiEvent Class Referenceabstract

#include <XrdSsiEvent.hh>

+ Inheritance diagram for XrdSsiEvent:
+ Collaboration diagram for XrdSsiEvent:

Public Member Functions

 XrdSsiEvent ()
 
 ~XrdSsiEvent ()
 
void AddEvent (XrdCl::XRootDStatus *st, XrdCl::AnyObject *resp)
 
void ClrEvent ()
 
virtual void DoIt ()
 
virtual void HandleResponse (XrdCl::XRootDStatus *status, XrdCl::AnyObject *response)
 
virtual int XeqEvent (XrdCl::XRootDStatus *st, XrdCl::AnyObject **resp)=0
 
virtual void XeqEvFin ()=0
 
- Public Member Functions inherited from XrdJob
 XrdJob (const char *desc="")
 
virtual ~XrdJob ()
 
- Public Member Functions inherited from XrdCl::ResponseHandler
virtual ~ResponseHandler ()
 
virtual void HandleResponseWithHosts (XRootDStatus *status, AnyObject *response, HostList *hostList)
 

Protected Attributes

char tident [24]
 

Additional Inherited Members

- Static Public Member Functions inherited from XrdCl::ResponseHandler
static ResponseHandlerWrap (std::function< void(XRootDStatus &, AnyObject &)> func)
 
static ResponseHandlerWrap (std::function< void(XRootDStatus *, AnyObject *)> func)
 
- Public Attributes inherited from XrdJob
const char * Comment
 
XrdJobNextJob
 

Detailed Description

Definition at line 36 of file XrdSsiEvent.hh.

Constructor & Destructor Documentation

◆ XrdSsiEvent()

XrdSsiEvent::XrdSsiEvent ( )
inline

Definition at line 54 of file XrdSsiEvent.hh.

54  : XrdJob(tident), lastEvent(0),
55  running(false), isClear(true)
56  {*tident = 0;}
XrdJob(const char *desc="")
Definition: XrdJob.hh:51
char tident[24]
Definition: XrdSsiEvent.hh:62

References tident.

◆ ~XrdSsiEvent()

XrdSsiEvent::~XrdSsiEvent ( )
inline

Definition at line 58 of file XrdSsiEvent.hh.

58 {if (!isClear) ClrEvent(&thisEvent);}
void ClrEvent()
Definition: XrdSsiEvent.hh:42

References ClrEvent().

+ Here is the call graph for this function:

Member Function Documentation

◆ AddEvent()

void XrdSsiEvent::AddEvent ( XrdCl::XRootDStatus st,
XrdCl::AnyObject resp 
)

Definition at line 56 of file XrdSsiEvent.cc.

57 {
58  EPNAME("AddEvent");
59  XrdSsiMutexMon monMutex(evMutex);
60 
61 // Indicate there is pending event here
62 //
63  DEBUG("New event: isClear=" <<isClear <<" running=" <<running);
64  isClear = false;
65 
66 // If the base object has no status then we need to set it and schedule
67 // ourselves for processing if not already running.
68 //
69  if (!thisEvent.status)
70  {thisEvent.status = st;
71  thisEvent.response = resp;
72  if (!running)
73  {running = true;
74  XrdSsi::schedP->Schedule(this);
75  }
76  return;
77  }
78 
79 // Allocate a new event object and chain it from the base event. This also
80 // implies that we doesn't need to be scheduled as it already was scheduled.
81 //
82  frMutex.Lock();
83  EventData *edP = freeEvent;
84  if (!edP) edP = new EventData(st, resp);
85  else {freeEvent = edP->next;
86  edP->status = st;
87  edP->response = resp;
88  edP->next = 0;
89  }
90  frMutex.UnLock();
91 
92 // Establish the last event
93 //
94  if (lastEvent) lastEvent->next = edP;
95  else thisEvent .next = edP;
96  lastEvent = edP;
97 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
void Schedule(XrdJob *jp)
XrdScheduler * schedP
Definition: XrdSsiClient.cc:74

References DEBUG, EPNAME, XrdSsi::schedP, and XrdScheduler::Schedule().

Referenced by HandleResponse().

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

◆ ClrEvent()

void XrdSsiEvent::ClrEvent ( )
inline

Definition at line 42 of file XrdSsiEvent.hh.

42 {evMutex.Lock();ClrEvent(&thisEvent);evMutex.UnLock();}

References ClrEvent(), XrdSsiMutex::Lock(), and XrdSsiMutex::UnLock().

Referenced by ~XrdSsiEvent(), ClrEvent(), and XrdSsiServReal::Recycle().

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

◆ DoIt()

void XrdSsiEvent::DoIt ( )
virtual

Implements XrdJob.

Definition at line 148 of file XrdSsiEvent.cc.

149 {
150  EPNAME("RunEvent");
151  EventData *edP, myEvent;
152  int rc;
153 
154 // Process all of the events in our list. This is a tricky proposition because
155 // the event executor may delete us upon return. Hence we do not directly use
156 // any data members of this class, only copies. The return rc tells what to do.
157 // rc > 0: terminate event processing and conclude in a normal fashion.
158 // rc = 0: reflect next event.
159 // rc < 0: immediately return as this object has become invalid.
160 //
161  evMutex.Lock();
162 do{thisEvent.Move2(myEvent);
163  lastEvent = 0;
164  isClear = true;
165  evMutex.UnLock();
166  edP = &myEvent;
167 
168  do {if ((rc = XeqEvent(edP->status, &edP->response)) != 0) break;
169  edP = edP->next;
170  } while(edP);
171 
172  ClrEvent(&myEvent);
173 
174  if (rc)
175  {DEBUG("XeqEvent requested " <<(rc < 0 ? "halt" : "flush"));
176  if (rc < 0) return;
177  evMutex.Lock();
178  break;
179  }
180 
181  evMutex.Lock();
182  } while(thisEvent.status);
183 
184 // Indicate we are no longer running
185 //
186  running = false;
187  evMutex.UnLock();
188 
189 // The last thing we need to do is to tell the event handler that we are done
190 // as it may decide to delete this object if no more events will occur.
191 //
192  XeqEvFin();
193 }
virtual void XeqEvFin()=0
virtual int XeqEvent(XrdCl::XRootDStatus *st, XrdCl::AnyObject **resp)=0

References DEBUG, and EPNAME.

◆ HandleResponse()

virtual void XrdSsiEvent::HandleResponse ( XrdCl::XRootDStatus status,
XrdCl::AnyObject response 
)
inlinevirtual

Called when a response to associated request arrives or an error occurs

Parameters
statusstatus of the request
responsean object associated with the response (request dependent)

Reimplemented from XrdCl::ResponseHandler.

Definition at line 46 of file XrdSsiEvent.hh.

48  {AddEvent(status, response);}
void AddEvent(XrdCl::XRootDStatus *st, XrdCl::AnyObject *resp)
Definition: XrdSsiEvent.cc:56

References AddEvent().

+ Here is the call graph for this function:

◆ XeqEvent()

virtual int XrdSsiEvent::XeqEvent ( XrdCl::XRootDStatus st,
XrdCl::AnyObject **  resp 
)
pure virtual

Implemented in XrdSsiTaskReal, and XrdSsiSessReal.

◆ XeqEvFin()

virtual void XrdSsiEvent::XeqEvFin ( )
pure virtual

Implemented in XrdSsiTaskReal, and XrdSsiSessReal.

Member Data Documentation

◆ tident

char XrdSsiEvent::tident[24]
protected

Definition at line 62 of file XrdSsiEvent.hh.

Referenced by XrdSsiEvent(), and XrdSsiTaskReal::SetTaskID().


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