Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DbuSignalHandler.h

Go to the documentation of this file.
00001 #ifndef DBUSIGNALHANDLER_H
00002 #define DBUSIGNALHANDLER_H
00003 
00005 // $Id: DbuSignalHandler.h,v 1.4 2005/04/19 09:25:56 rhatcher Exp $
00006 //
00007 // rhatcher@fnal.gov
00009 
00010 #include <stdlib.h>
00011 #include "TSysEvtHandler.h"
00012 
00013 class DbuSignalHandler : public TObject 
00014 {
00015 
00016  public:
00017 
00018   static DbuSignalHandler& Instance();
00019 
00020   void Delay();
00021   void HandleDelayedSignal();
00022 
00023   static bool SignalAction(int signal);
00024 
00025  private:
00026 
00027   // Singleton
00028   DbuSignalHandler();
00029   DbuSignalHandler(DbuSignalHandler& /* dsh */) : TObject() { abort(); }
00030   DbuSignalHandler& operator=(const DbuSignalHandler& dsh)
00031     { abort(); return const_cast<DbuSignalHandler&>(dsh); }
00032   ~DbuSignalHandler();
00033   
00034 
00035    // Helper class to handle deletion of singleton
00036    struct Cleaner {
00037       void ClassIsUsed() { }; // dummy method to keep compilers quiet
00038       ~Cleaner() {
00039          if (DbuSignalHandler::fgInstance!=0) {
00040             delete DbuSignalHandler::fgInstance;
00041             DbuSignalHandler::fgInstance = 0;
00042          }
00043       }
00044    };
00045    friend struct Cleaner;   
00046 
00047   static DbuSignalHandler *fgInstance;
00048 
00049   TSignalHandler* fSIGINT;
00050   TSignalHandler* fSIGTERM;
00051 
00052 };
00053 
00054 #endif // DBUSIGNALHANDLER_H
00055 

Generated on Mon Feb 15 11:06:36 2010 for loon by  doxygen 1.3.9.1