Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TXSocketHandler.h
Go to the documentation of this file.
1 // @(#)root/proofx:$Id$
2 // Author: G. Ganis Oct 2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TXSocketHandler
13 #define ROOT_TXSocketHandler
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TXSocketHandler //
18 // //
19 // Input handler for xproofd sockets. These sockets cannot be directly //
20 // monitored on their descriptor, because the reading activity goes via //
21 // the reader thread. This class allows to handle this problem. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TSysEvtHandler.h"
26 #include "TXSocket.h"
27 
28 class TXSocketHandler : public TFileHandler {
29 
30 // friend class TXSocket;
31 
32  TFileHandler *fHandler; // Handler associated to the input socket
33  TSocket *fInputSock; // Input socket from client or master
34 
35  void SetHandler(TFileHandler *h, TSocket *s)
36  { fHandler = h; fInputSock = s; }
37 
38  static TXSocketHandler *fgSocketHandler; // Input socket handler
39 
40  TXSocketHandler(TFileHandler *h, TSocket *s) :
41  TFileHandler(TXSocket::fgPipe.GetRead(), 1)
42  { fHandler = h; fInputSock = s; }
43 public:
44  virtual ~TXSocketHandler() { }
45 
46  Bool_t Notify();
47  Bool_t ReadNotify() { return Notify(); }
48 
49  static TXSocketHandler *GetSocketHandler(TFileHandler *h = 0, TSocket *s = 0);
50 
51  ClassDef(TXSocketHandler, 0) //Input handler class for xproofd sockets
52 };
53 
54 #endif