|
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 /* This file is part of the XRootD software suite. */ 00013 /* */ 00014 /* XRootD is free software: you can redistribute it and/or modify it under */ 00015 /* the terms of the GNU Lesser General Public License as published by the */ 00016 /* Free Software Foundation, either version 3 of the License, or (at your */ 00017 /* option) any later version. */ 00018 /* */ 00019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 00020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 00021 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 00022 /* License for more details. */ 00023 /* */ 00024 /* You should have received a copy of the GNU Lesser General Public License */ 00025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 00026 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 00027 /* */ 00028 /* The copyright holder's institutional names and contributor's names may not */ 00029 /* be used to endorse or promote products derived from this software without */ 00030 /* specific prior written permission of the institution or contributor. */ 00031 /******************************************************************************/ 00032 00033 #include "XrdFrc/XrdFrcRequest.hh" 00034 #include "XrdOuc/XrdOucHash.hh" 00035 #include "XrdSys/XrdSysPthread.hh" 00036 00037 class XrdFrcReqFile; 00038 class XrdFrcRequest; 00039 class XrdFrmXfrJob; 00040 00041 class XrdFrmXfrQueue 00042 { 00043 public: 00044 00045 static int Add(XrdFrcRequest *rP, XrdFrcReqFile *reqF, int theQ); 00046 00047 static void Done(XrdFrmXfrJob *xP, const char *Msg); 00048 00049 static XrdFrmXfrJob *Get(); 00050 00051 static int Init(); 00052 00053 static void StopMon(void *parg); 00054 00055 XrdFrmXfrQueue() {} 00056 ~XrdFrmXfrQueue() {} 00057 00058 private: 00059 00060 static XrdFrmXfrJob *Pull(); 00061 static int Notify(XrdFrcRequest *rP,int qN,int rc,const char *msg=0); 00062 static void Send2File(char *Dest, char *Msg, int Mln); 00063 static void Send2UDP(char *Dest, char *Msg, int Mln); 00064 static int Stopped(int qNum); 00065 static const char *xfrName(XrdFrcRequest &reqData, int isOut); 00066 00067 static XrdSysMutex hMutex; 00068 static XrdOucHash<XrdFrmXfrJob> hTab; 00069 00070 static XrdSysMutex qMutex; 00071 static XrdSysSemaphore qReady; 00072 00073 struct theQueue 00074 {XrdSysSemaphore Avail; 00075 XrdFrmXfrJob *Free; 00076 XrdFrmXfrJob *First; 00077 XrdFrmXfrJob *Last; 00078 XrdSysSemaphore Alert; 00079 const char *File; 00080 const char *Name; 00081 int Stop; 00082 int qNum; 00083 theQueue() : Avail(0),Free(0),First(0),Last(0),Alert(0),Stop(0) {} 00084 ~theQueue() {} 00085 }; 00086 static theQueue xfrQ[XrdFrcRequest::numQ]; 00087 }; 00088 #endif
1.7.6.1