TXSocketHandler.cxx

Go to the documentation of this file.
00001 // @(#)root/proofx:$Id: TXSocketHandler.cxx 26678 2008-12-05 14:53:23Z ganis $
00002 // Author: Gerardo Ganis  12/12/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 //////////////////////////////////////////////////////////////////////////
00013 //                                                                      //
00014 // TXSocketHandler                                                      //
00015 //                                                                      //
00016 // Input handler for xproofd sockets. These sockets cannot be directly  //
00017 // monitored on their descriptor, because the reading activity goes via //
00018 // the reader thread. This class allows to handle this problem.         //
00019 //                                                                      //
00020 //////////////////////////////////////////////////////////////////////////
00021 
00022 #include "TMonitor.h"
00023 #include "TProof.h"
00024 #include "TSlave.h"
00025 #include "TXSocketHandler.h"
00026 #include "TXHandler.h"
00027 #include "TList.h"
00028 
00029 
00030 ClassImp(TXSocketHandler)
00031 
00032 // Unique instance of the socket input handler
00033 TXSocketHandler *TXSocketHandler::fgSocketHandler = 0;
00034 
00035 //______________________________________________________________________________
00036 Bool_t TXSocketHandler::Notify()
00037 {
00038    // Set readiness on the monitor
00039 
00040    if (gDebug > 2)
00041       TXSocket::fgPipe.DumpReadySock();
00042 
00043    // Get the socket
00044    TXSocket *s = TXSocket::fgPipe.GetLastReady();
00045    if (gDebug > 2)
00046       Info("Notify", "ready socket %p (%s) (input socket: %p)",
00047                      s, (s ? s->GetTitle() : "***undef***"), fInputSock);
00048 
00049    // If empty, nothing to do
00050    if (!s) {
00051       Warning("Notify","socket-ready list is empty!");
00052       return kTRUE;
00053    }
00054 
00055    // Handle this input
00056    s->fHandler->HandleInput();
00057 
00058    // We are done
00059    return kTRUE;
00060 }
00061 
00062 //_______________________________________________________________________
00063 TXSocketHandler *TXSocketHandler::GetSocketHandler(TFileHandler *h, TSocket *s)
00064 {
00065    // Get an instance of the input socket handler with 'h' as handler,
00066    // connected to socket 's'.
00067    // Create the instance, if not already existing
00068 
00069    if (!fgSocketHandler)
00070       fgSocketHandler = new TXSocketHandler(h, s);
00071    else
00072       if (h && s)
00073          fgSocketHandler->SetHandler(h, s);
00074 
00075    return fgSocketHandler;
00076 }

Generated on Tue Jul 5 14:52:28 2011 for ROOT_528-00b_version by  doxygen 1.5.1