00001 // @(#)root/proofx:$Id: TXSocketHandler.h 26678 2008-12-05 14:53:23Z ganis $ 00002 // Author: G. Ganis Oct 2005 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TXSocketHandler 00013 #define ROOT_TXSocketHandler 00014 00015 ////////////////////////////////////////////////////////////////////////// 00016 // // 00017 // TXSocketHandler // 00018 // // 00019 // Input handler for xproofd sockets. These sockets cannot be directly // 00020 // monitored on their descriptor, because the reading activity goes via // 00021 // the reader thread. This class allows to handle this problem. // 00022 // // 00023 ////////////////////////////////////////////////////////////////////////// 00024 00025 #ifndef ROOT_TSysEvtHandler 00026 #include "TSysEvtHandler.h" 00027 #endif 00028 #ifndef ROOT_TXSocket 00029 #include "TXSocket.h" 00030 #endif 00031 00032 class TXSocketHandler : public TFileHandler { 00033 00034 // friend class TXSocket; 00035 00036 TFileHandler *fHandler; // Handler associated to the input socket 00037 TSocket *fInputSock; // Input socket from client or master 00038 00039 void SetHandler(TFileHandler *h, TSocket *s) 00040 { fHandler = h; fInputSock = s; } 00041 00042 static TXSocketHandler *fgSocketHandler; // Input socket handler 00043 00044 TXSocketHandler(TFileHandler *h, TSocket *s) : 00045 TFileHandler(TXSocket::fgPipe.GetRead(), 1) 00046 { fHandler = h; fInputSock = s; } 00047 public: 00048 virtual ~TXSocketHandler() { } 00049 00050 Bool_t Notify(); 00051 Bool_t ReadNotify() { return Notify(); } 00052 00053 static TXSocketHandler *GetSocketHandler(TFileHandler *h = 0, TSocket *s = 0); 00054 00055 ClassDef(TXSocketHandler, 0) //Input handler class for xproofd sockets 00056 }; 00057 00058 #endif