Logo ROOT  
Reference Guide
TXSocketHandler.cxx
Go to the documentation of this file.
1 // @(#)root/proofx:$Id$
2 // Author: Gerardo Ganis 12/12/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 /** \class TXSocketHandler
13 \ingroup proofx
14 
15 Input handler for XProofD sockets. These sockets cannot be directly
16 monitored on their descriptor, because the reading activity goes via
17 the internal reader thread. This class allows to handle the related issue.
18 
19 */
20 
21 #include "TMonitor.h"
22 #include "TProof.h"
23 #include "TSlave.h"
24 #include "TXSocketHandler.h"
25 #include "TXHandler.h"
26 #include "TList.h"
27 
28 
30 
31 // Unique instance of the socket input handler
33 
34 ////////////////////////////////////////////////////////////////////////////////
35 /// Set readiness on the monitor
36 
38 {
39  if (gDebug > 2)
41 
42  // Get the socket
44  if (gDebug > 2)
45  Info("Notify", "ready socket %p (%s) (input socket: %p) (fFileNum: %d)",
46  s, (s ? s->GetTitle() : "***undef***"), fInputSock, fFileNum);
47 
48  // If empty, nothing to do
49  if (!s) {
50  Warning("Notify","socket-ready list is empty!");
51  return kTRUE;
52  }
53 
54  // Handle this input
55  s->fHandler->HandleInput();
56 
57  // We are done
58  return kTRUE;
59 }
60 
61 ////////////////////////////////////////////////////////////////////////////////
62 /// Get an instance of the input socket handler with 'h' as handler,
63 /// connected to socket 's'.
64 /// Create the instance, if not already existing
65 
67 {
68  if (!fgSocketHandler)
70  else
71  if (h && s)
73 
74  return fgSocketHandler;
75 }
TXSocket
Definition: TXSocket.h:59
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TXSocketHandler::GetSocketHandler
static TXSocketHandler * GetSocketHandler(TFileHandler *h=0, TSocket *s=0)
Get an instance of the input socket handler with 'h' as handler, connected to socket 's'.
Definition: TXSocketHandler.cxx:66
TSlave.h
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TXSocketHandler::fInputSock
TSocket * fInputSock
Definition: TXSocketHandler.h:39
TObject::Info
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:864
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:168
TMonitor.h
TXHandler.h
TXSocketHandler::SetHandler
void SetHandler(TFileHandler *h, TSocket *s)
Definition: TXSocketHandler.h:41
TList.h
TXSocket::fgPipe
static TXSockPipe fgPipe
Definition: TXSocket.h:111
TXSocketHandler::TXSocketHandler
TXSocketHandler(TFileHandler *h, TSocket *s)
Definition: TXSocketHandler.h:46
bool
TSocket
Definition: TSocket.h:41
h
#define h(i)
Definition: RSha256.hxx:124
TXSocketHandler
Definition: TXSocketHandler.h:28
TXSockPipe::DumpReadySock
void DumpReadySock()
Dump content of the ready socket list.
Definition: TXSocket.cxx:2378
TProof.h
TXSocketHandler.h
gDebug
R__EXTERN Int_t gDebug
Definition: RtypesCore.h:119
TXSocketHandler::Notify
Bool_t Notify()
Set readiness on the monitor.
Definition: TXSocketHandler.cxx:37
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:876
TFileHandler::fFileNum
int fFileNum
Definition: TSysEvtHandler.h:68
TFileHandler
Definition: TSysEvtHandler.h:65
TXSockPipe::GetLastReady
TXSocket * GetLastReady()
Return last ready socket.
Definition: TXSocket.cxx:2393
TXSocketHandler::fgSocketHandler
static TXSocketHandler * fgSocketHandler
Definition: TXSocketHandler.h:44