|
xrootd
|
00001 #ifndef __FRMXFRQUEUE_H__ 00002 #define __FRMXFRQUEUE_H__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d F r m X f r Q u e u e . h h */ 00006 /* */ 00007 /* (c) 2010 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 #include "XrdFrc/XrdFrcRequest.hh" 00014 #include "XrdOuc/XrdOucHash.hh" 00015 #include "XrdSys/XrdSysPthread.hh" 00016 00017 class XrdFrcReqFile; 00018 class XrdFrcRequest; 00019 class XrdFrmXfrJob; 00020 00021 class XrdFrmXfrQueue 00022 { 00023 public: 00024 00025 static int Add(XrdFrcRequest *rP, XrdFrcReqFile *reqF, int theQ); 00026 00027 static void Done(XrdFrmXfrJob *xP, const char *Msg); 00028 00029 static XrdFrmXfrJob *Get(); 00030 00031 static int Init(); 00032 00033 static void StopMon(void *parg); 00034 00035 XrdFrmXfrQueue() {} 00036 ~XrdFrmXfrQueue() {} 00037 00038 private: 00039 00040 static XrdFrmXfrJob *Pull(); 00041 static int Notify(XrdFrcRequest *rP,int qN,int rc,const char *msg=0); 00042 static void Send2File(char *Dest, char *Msg, int Mln); 00043 static void Send2UDP(char *Dest, char *Msg, int Mln); 00044 static int Stopped(int qNum); 00045 static const char *xfrName(XrdFrcRequest &reqData, int isOut); 00046 00047 static XrdSysMutex hMutex; 00048 static XrdOucHash<XrdFrmXfrJob> hTab; 00049 00050 static XrdSysMutex qMutex; 00051 static XrdSysSemaphore qReady; 00052 00053 struct theQueue 00054 {XrdSysSemaphore Avail; 00055 XrdFrmXfrJob *Free; 00056 XrdFrmXfrJob *First; 00057 XrdFrmXfrJob *Last; 00058 XrdSysSemaphore Alert; 00059 const char *File; 00060 const char *Name; 00061 int Stop; 00062 int qNum; 00063 theQueue() : Avail(0),Free(0),First(0),Last(0),Alert(0),Stop(0) {} 00064 ~theQueue() {} 00065 }; 00066 static theQueue xfrQ[XrdFrcRequest::numQ]; 00067 }; 00068 #endif
1.7.5